PEEKCHARQQ

Run-Time Function: Checks the keystroke buffer for a recent console keystroke and returns .TRUE. if there is a character in the buffer or .FALSE. if there is not.

Module: USE DFLIB

Syntax

result = PEEKCHARQQ( )

Results:

The result is of type LOGICAL(4). The result is .TRUE. if there is a character waiting in the keyboard buffer; otherwise, .FALSE..

To find out the value of the key in the buffer, call GETCHARQQ. If there is no character waiting in the buffer when you call GETCHARQQ, GETCHARQQ waits until there is a character in the buffer. If you call PEEKCHARQQ first, you prevent GETCHARQQ from halting your process while it waits for a keystroke. If there is a keystroke, GETCHARQQ returns it and resets PEEKCHARQQ to .FALSE..

Compatibility

CONSOLE DLL LIB

See Also: GETCHARQQ, GETSTRQQ, FGETC, GETC

Example

 USE DFLIB
 LOGICAL(4) pressed / .FALSE. /

 DO WHILE (.NOT. pressed)
   WRITE(*,*) ' Press any key'
   pressed = PEEKCHARQQ ( )
 END DO
 END