Caché MultiValue Basic Reference
[Back] [Next]
Go to:

Receives a single character of user input.
timeout Optional — An expression that resolves to an integer specifying the number of seconds to wait for user input before timing out.
Note that the parentheses are mandatory.
The KEYIN function is used in interactive programs to receive a single input character from the user. KEYIN pauses program execution while awaiting user input. It displays a prompt to receive a single input character. The appearance of this prompt is governed by the terminal emulator, not MVBasic. Program execution continues immediately upon input of a character. No Enter key is required.
In Caché MultiValue the input character is not echoed, regardless of the setting of ECHO. However, echoing is emulation-dependent.
If you specify a timeout value, KEYIN waits the specified number of seconds for user input. Upon time out it returns an empty string ("").
You can also use the IN function to receive a single character of user input, or the INPUT statement to receive one or more characters of user input. You can use the <<...>> inline prompt to prompt for a user input value to insert in a MVBasic statement or a MultiValue command line command. The <<...>> inline prompt is described in the Caché MultiValue Commands Reference.
KEYIN does not accept stacked input data. You can use the INPUT statement for user input of more than one character or for other user input options. You cannot use the DATA statement to supply a character to KEYIN.
The following example calls the KEYIN function to input a single character:
PRINT "input character:",x
In Caché, UniVerse, and several other emulations, the input character is never echoed, regardless of the setting of ECHO.
In D3, IN2, jBASE, MVBase, R83, POWER95, Reality, and Ultimate emulations, whether the input character is echoed depends on the setting of ECHO. In these emulations, when you specify ECHO ON the input character is echoed to the terminal; it is never echoed to the printer.
See Also