RosettaCodeData/Task/Keyboard-input-Flush-the-keyboard-buffer/Delphi/keyboard-input-flush-the-keyboard-buffer.delphi

19 lines
342 B
Text
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
program Flush_the_keyboard_buffer;
{$APPTYPE CONSOLE}
uses
Winapi.Windows;
var
StdIn: THandle;
begin
StdIn := GetStdHandle(STD_INPUT_HANDLE);
Writeln('Press any key you want, they will be erased:');
Sleep(5000);
FlushConsoleInputBuffer(StdIn);
Writeln('Now press any key you want, they will NOT be erased:');
readln;
end.