home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / TURBOPAS / TURB_INC.ZIP / INKEY.INC next >
Encoding:
Text File  |  1985-12-28  |  1.1 KB  |  37 lines

  1. {=====================================================}
  2. function InKey(wait:boolean; var special:boolean):char;
  3. {=====================================================}
  4. {
  5.    Turbo Pascal equivalent of BASIC's INKEY$ function
  6.  
  7.    Written by:  Tryg Helseth
  8.                 Minneapolis, Minnesota
  9.  
  10.    Last Revision:  12/27/84
  11.  
  12.    This function gets the next character from the keyboard.  If a
  13.    special key is detected (two characters sent), then the special
  14.    flag is set to true and the second character returned.  The flag
  15.    is false otherwise.
  16.  
  17.    If wait is true, then InKey will wait until a key has been pressed.
  18.    A null value (#0) is returned if wait is false and no key was pressed.
  19. }
  20.  
  21. var InChar : char;
  22.  
  23. begin
  24.    special := false;
  25.    if wait or KeyPressed then begin
  26.       read(kbd,InChar);
  27.     { test for special character }
  28.       if KeyPressed then begin
  29.          read(kbd,InChar);
  30.          special := true
  31.          end;
  32.       InKey := InChar
  33.       end {if}
  34.    else
  35.       InKey := #0
  36. end; {INKEY}
  37.