28
ACCEPT Directive
Read Single Keystroke
Format
ACCEPT(chan[,fileopt])char$
Where:
chan
Channel or logical file number.
char$
String variable. Receives the input character.
ERR=stmtref On error , transfer to program line number/label.
NUL=stmtref On no input, transfer to program line number/label.
TIM=num Maximum time-out value in integer seconds.
Description
Use the ACCEPT directive to read a single keystroke (character) from a terminal. The
ACCEPT directive doesn't echo the keystroke/character to the terminal. If no input is
in the input buffer, the ACCEPT directive waits for terminal input. Control transfers
to the stmtref if you include a NUL= option and the terminal input buffer has no
data in it.
See Also
Example
The following example reads one record at a time and displays it on the terminal.
When any key is pressed, control drops to line 130 (ending the listing of the file).
0100
READ RECORD (1,END=0130)R$
0110
PRINT R$
0120
ACCEPT (0,NUL=0100,TIM=0.5)X$
0130
PRINT "<Display halted>"