#include <iostream>
#include <fstream>
using std::cout;
using std::endl;
int main()
{
std::ofstream file("d:\\test.txt");
file << std::unitbuf << "C++ " << "Programming" << '\n'; // flush 3 times
file.close();
return 0;
}
/*
run:
test.txt:
---------
C++ Programming
*/