fpurge [C++ Reference]
Keywords: c,io,fpurge
Date: 2008-10-14T15:42:01-0700

[[fpurge]]
C++ Reference
Translations of this page?:

- en
- br-pt
- cn
- cz
- de
- es
- fr
- it
- jp
- nl
- pl
- ro
- ru
- sk
- tr
- tw

## fpurge

Syntax:

        #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.

         printf( "Before first call\n" );
         fpurge( stdout );
         shady_function();
         printf( "Before second call\n" );
         fpurge( stdout );
         dangerous_dereference();

Related Topics: fclose, fopen, fread, fwrite, fflush, getc, putc

Edit this page • Old revisions
• • • Login • Index • Recent changes • RSS • cc •