By definition taken from: http://www.cplusplus.com/reference/iostream/ostream/flush/ , it is not clear why the function exists, and for what purpose you would use it for. Wh
Writing file on hard-drive one character per time is inefficient. Sending a packet over network for each character is inefficient. Therefore streaming is often cached. flush() is just a way to control "manually" during streaming when the cache must be flushed and the stuff should be really sent or written.