t72_keypress.pas 559 B

12345678910111213141516
  1. program t72_keypress;
  2. { t72 -- KeyPressed. DOS AH=0Bh asks whether a character is waiting, and
  3. TP3 lets the function be written without a parameter list (CALC.INC's Flash
  4. ends `until KeyPressed'). The fixture asks with one byte of input pending,
  5. reads it, and asks again - so both the true and the false answer are
  6. checked, and the call must not consume the byte. }
  7. var
  8. ch : char;
  9. begin
  10. if KeyPressed then writeln ('key') else writeln ('none');
  11. read (ch);
  12. writeln (ch);
  13. if KeyPressed then writeln ('more') else writeln ('end')
  14. end.