ex33.pp 575 B

12345678910111213141516171819202122232425
  1. Program Example33;
  2. { Program to demonstrate the Select function. }
  3. Uses linux;
  4. Var FDS : FDSet;
  5. begin
  6. FD_Zero (FDS);
  7. FD_Set (0,FDS);
  8. Writeln ('Press the <ENTER> to continue the program.');
  9. { Wait until File descriptor 0 (=Input) changes }
  10. Select (1,@FDS,nil,nil,nil);
  11. { Get rid of <ENTER> in buffer }
  12. readln;
  13. Writeln ('Press <ENTER> key in less than 2 seconds...');
  14. FD_Zero (FDS);
  15. FD_Set (0,FDS);
  16. if Select (1,@FDS,nil,nil,2000)>0 then
  17. Writeln ('Thank you !')
  18. { FD_ISSET(0,FDS) would be true here. }
  19. else
  20. Writeln ('Too late !');
  21. end.