The function only has meaning for buffered streams, in which case it effectively calls the pubsync member of the streambuf object (rdbuf()->pubsync()) associated to the stream.
A manipulator exists with the same name and behavior (see flush manipulator).
Parameters
noneReturn Value
The function returns *this.If an error happens while flushing a buffered stream, the badbit flag is set (which can be checked with member bad). Also, depending on the values set through member exceptions, this may cause an exception of type ios_base::failure to be thrown.
Example
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
|
When this example is executed the content of the file test.txt is updated 100 times.
Basic template member declaration
( basic_ostream<charT,traits> ) |
See also
| flush | Flush stream buffer (manipulator function) |
| endl | Insert newline and flush (manipulator function) |
| istream::sync | Synchronize input buffer with source of characters (public member function) |
