Top  Previous  Next


The KEYINV() and KEYINCV() functions read a single keystroke from the keyboard.










The KEYINV() function pauses program execution until a key is pressed. The code point value of the character associated with that key is returned as the value of the function. The character is not echoed to the display.


The KEYINCV() function is identical except that the case of alphabetic characters is inverted if case inversion has been enabled.


KEYINV() and KEYINCV() do not take data from the DATA statement queue.


The optional timeout parameter specifies a period in seconds after which the function will return if no input is received. In this case the returned value is a null string and the STATUS() function will return ER$TIMEOUT. The timeout value may be fractional to specify timeouts of less than one second. Values less than 10mS or greater than 24 hours may not behave correctly.


A null string is also returned when taking input from a pipe if the piped data stream is exhausted. In this case the STATUS() function will return ER$EOF. The value returned by the STATUS() function is not significant unless KEYIN() has returned a null string.



Character Values


On Windows console sessions, special keys such as the function keys, ALT sequences and special keys (Home, Delete, cursor moves, etc) are represented by code point values that lie in the Unicode BMP Private Use Area. On non-ECS mode systems, it is not possible to encode these values as a single character. Click here for a table of key code values.



See also: