#include <cstdio> int fpurge(FILE* stream);
The function fpurge() erases any input or output buffered in the given stream. For output streams this discards any unwritten output. For input streams this discards any input read from the underlying object but not yet obtained via getc(); this includes any text pushed back via ungetc().
The fpurge() function is non-standard, and is not recommended even on systems where it's provided.