The FlushConsoleInputBuffer function flushes the console input buffer. All input records currently in the input buffer are discarded.
BOOL FlushConsoleInputBuffer(
HANDLE hConsoleInput // handle to console input buffer
);
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in wincon.h.
Import Library: Use kernel32.lib.
Consoles and Character-Mode Support Overview, Console Functions, GetNumberOfConsoleInputEvents, PeekConsoleInput, ReadConsoleInput, WriteConsoleInput