Directives

ACCEPT

Read Single Keystroke

Format

ACCEPT(chan[,fileopt])char$
 
Where:

chan

Channel or logical file number.

char$

String variable. Receives the input character.

fileopt

Supported file options. See File Options:

ERR=stmtref

On error, transfer to program line number/statement label

NUL=stmtref

On no input, transfer to program line number/statement 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 does not 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

OBTAIN Get Hidden Terminal Input
INPUT Get Input from Terminal

Example

This example reads one record at a time and displays it on the terminal. When any key is pressed, control drops to line 0130 (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>"