GET_KBRD Function

Returns the next character available from standard input (file unit 0).

Usage

    result = GET_KBRD(wait)

Input Parameters

wait—If wait is zero, GET_KBRD returns the null string if there are no characters in the terminal typeahead buffer. If it is nonzero, GET_KBRD waits for a character to be typed before returning.

Returned Value

result—Next character available from standard input, as a one-character string.

Keywords

None.

Example

In this example, a character is read from the keyboard, and the character and its ASCII code are echoed to the screen. The loop is terminated when “q” or “Q” is typed.

; Retrieve keyboard input, placing result in the variable a.
REPEAT BEGIN $
   a = GET_KBRD(1) & $
   ; Display the character entered and its associated ASCII code.  & $
   ; Terminate loop when "q" or "Q" is entered. & $
   PRINT, a,' = ', BYTE(a) & $
ENDREP UNTIL STRLOWCASE(a) EQ 'q'