Categories | Alphabetical | Classes | All Contents | [ < ] | [ > ]

GET_KBRD


Syntax | Return Value | Arguments | Keywords |Examples | Version History | See Also

The GET_KBRD function returns the next character available from the standard input (IDL file unit 0).

Note
GET_KBRD is intended for use in IDL's UNIX command-line mode. While GET_KBRD will return values for some characters when run from the IDL Development Environment (either UNIX or Microsoft Windows), other characters are treated as special cases by the underlying windowing system, and may not be returned by GET_KBRD.

Syntax

Result = GET_KBRD(Wait)

Return Value

Returns a one-character string containing the next available character that is input from the keyboard.

Arguments

Wait

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.

Keywords

None.

Examples

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
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:

PRINT, C

IDL prints the paragraph marker,"¶".

GET_KBRD cannot be used to return control characters or other editing keys (e.g., Delete, Backspace, etc.). These characters are used for keyboard shortcuts and command line editing only. GET_KBRD can be used to return the Enter key.

Version History

Introduced: Original

See Also

READ/READF


Categories | Alphabetical | Classes | All Contents | [ < ] | [ > ]