home *** CD-ROM | disk | FTP | other *** search
- {=====================================================}
- function InKey(wait:boolean; var special:boolean):char;
- {=====================================================}
- {
- Turbo Pascal equivalent of BASIC's INKEY$ function
-
- Written by: Tryg Helseth
- Minneapolis, Minnesota
-
- Last Revision: 12/27/84
-
- This function gets the next character from the keyboard. If a
- special key is detected (two characters sent), then the special
- flag is set to true and the second character returned. The flag
- is false otherwise.
-
- If wait is true, then InKey will wait until a key has been pressed.
- A null value (#0) is returned if wait is false and no key was pressed.
- }
-
- var InChar : char;
-
- begin
- special := false;
- if wait or KeyPressed then begin
- read(kbd,InChar);
- { test for special character }
- if KeyPressed then begin
- read(kbd,InChar);
- special := true
- end;
- InKey := InChar
- end {if}
- else
- InKey := #0
- end; {INKEY}
-