The readkey function

Description

The readkey function returns the next key in the keyboard buffer. If there are no keys in the keyboard buffer then this function waits until a key is pressed. You can use the keypressed function to check the keyboard buffer for keys before calling this function. The type of the value returned by this function is always char.

If the next key in the keyboard buffer corresponds to a printable character then this function simply returns the character, however if the key does not correspond to a printable character (e.g. Page Up) then this function actually returns two characters on separate calls to this function. In other words this function has to be called twice to completly read non-printable keys from the keyboard buffer. The first call to this function returns chr(0) and the second call returns the scan code for the key.

Parameter

None.

Portability

Operating Systems: Windows
Standard Pascal: No