public member function
<ostream> <iostream>
std::basic_ostream::flushFlush output stream buffer
Synchronizes the associated stream buffer with its controlled output sequence.For stream buffer objects that implement intermediate buffers, this function requests all characters to be written to the controlled sequence.
Internally, the function accesses the output sequence by first constructing a sentry object. Then (if good), it calls pubsync on its associated stream buffer object, and finally destroys the sentry object before returning.
A manipulator exists with the same name and behavior (see flush).
*this
).
Errors are signaled by modifying the internal state flags:
If the operation sets an internal state flag that was registered with member exceptions, the function throws an exception of member type failure.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Flushing files
#include <fstream> // std::ofstream
int main () {
std::ofstream outfile ("test.txt");
for (int n=0; n<100; ++n)
{
outfile << n;
outfile.flush();
}
outfile.close();
return 0;
}
test.txt
100 times.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4