returns the next character available from the
standard input (IDL file unit 0) as a one-character string.
Result = GET_KBRD(
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.
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:
The following code fragment reads one character at a time and echoes that character's numeric code. It quits when a "q" is entered:
A = GET_KBRD(1)
ENDREP UNTIL A EQ 'q'
The GET_KBRD function can be used to return Windows special characters (in addition to standard keyboard characters), created by holding down the Alt key and entering the character's ANSI equivalent.
For example, to return the paragraph marker (¶), ANSI number 0182, enter:
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:
IDL should print the paragraph marker,"¶".
GET_KBRD cannot be used to return control characters, the Return key, or other editing keys (e.g., Delete, Backspace, etc.). These characters are used for keyboard shortcuts and command line editing only.