The GET_KBRD function returns the next character available from the standard input (IDL file unit 0) as a one-character string.
To wait for keyboard input and store one character in the variable R, enter:
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:
NOTE: 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:
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.