| I/O manipulators | ||||
| Print functions(C++23) | ||||
| C-style I/O | ||||
| Buffers | ||||
(C++23) | ||||
(C++98/26*) | ||||
(C++20) | ||||
| Streams | ||||
| Abstractions | ||||
| File I/O | ||||
| String I/O | ||||
| Array I/O | ||||
(C++23) | ||||
(C++23) | ||||
(C++23) | ||||
(C++98/26*) | ||||
(C++98/26*) | ||||
(C++98/26*) | ||||
| Synchronized Output | ||||
(C++20) | ||||
| Types | ||||
| Error category interface | ||||
(C++11) | ||||
(C++11) |
| Types and objects | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Functions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Defined in header <cstdio> | ||
int fflush(std::FILE* stream); | ||
For output streams (and for update streams on which the last operation was output), writes any unwritten data from thestream's buffer to the associated output device.
For input streams (and for update streams on which the last operation was input), the behavior is undefined.
If any data are written to an output device, returning from | (since C++26) |
Ifstream is a null pointer, the flushing operation specified above are performed on all open output streams, including the ones manipulated within library packages or otherwise not directly accessible to the program.
Contents |
| stream | - | the file stream to write out |
Returns0 on success. Otherwise returnsEOF and sets the error indicator of the file stream.
POSIXextends the specification offflush by defining its effects on an input stream, as long as that stream represents a file or another seekable device: in that case the POSIX file pointer is repositioned to match the C stream pointer (which effectively undoes any read buffering) and the effects of anystd::ungetc orstd::ungetwc that weren't yet read back from the stream are discarded.
Microsoft also extends the specification offflush by defining its effects on an input stream: in Visual Studio 2013 and prior, itdiscarded the input buffer, in Visual Studio 2015 and newer, ithas no effect, buffers are retained.
| opens a file (function)[edit] | |
| closes a file (function)[edit] | |
C documentation forfflush | |