The GET_KBRD function returns the next character available from the standard input (IDL file unit 0).
| Warning |
Result = GET_KBRD(Wait)
Returns a one-character string containing the next available character that is input from the keyboard.
If Wait is zero, GET_KBRD returns the null string if there are no characters in the terminal type-ahead buffer. If it is nonzero, the function waits for a character to be typed before returning.
None.
To wait for keyboard input and store one character in the variable R, enter:
R = GET_KBRD(1)
Press any key to return to the IDL prompt. To see the character that was typed, enter:
PRINT, R
The following code fragment reads one character at a time and echoes that character's numeric code. It quits when a "q" is entered:
REPEAT BEGIN A = GET_KBRD(1) PRINT, BYTE(A) ENDREP UNTIL A EQ 'q'
| Note |
C = GET_KBRD(1)
While GET_KBRD is waiting, press and hold the Alt key and type 0182 on the numeric keypad. When the IDL prompt returns, enter:PRINT, C
IDL prints the paragraph marker,"¶".Introduced: Original