get_key

Definition: integer i = get_key()
Description: Return the key that was pressed by the user, without waiting. Return -1 if no key was pressed. Special codes are returned for the function keys, arrow keys etc.
Comments: The operating system can hold a small number of key-hits in its keyboard buffer. get_key() will return the next one from the buffer, or -1 if the buffer is empty.

Run the key.bat program to see what key code is generated for each key on your keyboard.

Note that get_key() is for console applications only and usually has no place whatsoever in a gui application. It can only catch keystrokes when the console (assuming you have one) has focus; when the gui has focus then the gui absorbs any keystrokes, as you should expect - for example see K_ANY.
See Also: wait_key, getc