[fpc-pascal]Re: Better Alternative to delay()

Arne Hanssen nite at c2i.net
Wed Oct 15 18:09:51 CEST 2003


On Wed, 15 Oct 2003 13:59:44 +0930, George Patterson wrote:
>  Hi all,
>  
>  I am using the delay function to pause for an amount of time which works
>  but will not allow the user to stop the program from the console, using
>  ctrl-C. If I could trap the keystroke, I would be happy.
>  
>  Excuse the indentation...
>  
>  while not eof(sin) do
>      begin
>          repeat
>             readln (sin, line);
>   	   writeln (line);
>  	   //readln(input_text);
>  	   delay(250); //time is measured in milliseconds
>  	   input_text:='hello';
>  	   writeln(sout,input_text);
>  	until keypressed;
       if ReadKey = [CTRL-C] then ...
>      end;
>  close (sin);
  
Untested and somewhat wrong syntax, but if I understand your question
correctly, ReadKey should be what you are looking for.

-- 
Vennlig hilsen / Best regards
Arne Hanssen




More information about the fpc-pascal mailing list