1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
// pubsync member
#include <iostream> // std::cout, std::streambuf
#include <fstream> // std::ofstream
int main () {
std::ofstream ostr ("test.txt");
if (ostr) {
std::streambuf * pbuf = ostr.rdbuf();
pbuf->sputn ("First sentence\n",15);
pbuf->pubsync();
pbuf->sputn ("Second sentence\n",16);
ostr.close();
}
return 0;
}
|