qp.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
ReadKey Function
  Summary Details Example                                   Back
 
  Returns
 
    Char    One character from keyboard buffer; may be null character
            preceding extended ASCII code
 
  Description
 
    The ReadKey function returns a character from the keyboard buffer
    without echoing the character to standard output. ReadKey waits
    for keyboard input if the buffer is empty.
 
    Use the KeyPressed function to check if unread characters are in
    the keyboard buffer:
 
       IF KeyPressed THEN ch := ReadKey;
 
    Use ReadKey with a loop to wait until a certain key is pressed:
 
       REPEAT UNTIL ReadKey = Chr(27); (* wait for Escape *)
 
    Special keys such as ALT, arrow keys, and function keys generate
    extended (2-byte) ASCII codes. Use ReadKey to get these characters
    from the keyboard in two steps. If ReadKey returns a null character
    (ASCII 0), call ReadKey again to get the extended ASCII code:
 
       ch := Readkey; IF ch = Chr(0) THEN ch := ReadKey;
 
    If the input is CTRL+BREAK and CheckBreak has been set to False,
    ReadKey returns CTRL+C (ASCII 3). If CheckBreak is True (default),
    a CTRL+BREAK input causes a program to halt. The CheckBreak
    variable is defined in the Crt unit.