What is the difference between flush() and sync() in regard to fstream buffers?
I was reading the cplusplus.com tutorial on I/O . At the end, it says fstream buffers are synchronized with the file on disc Explicitly, with manipulators: When certain manipulators are used on streams, an explicit synchronization takes place. These manipulators are: flush and endl. and Explicitly, with member function sync(): Calling stream's member function sync(), which takes no parameters, causes an immediate synchronization. This function returns an int value equal to -1 if the stream has no associated buffer or in case of failure. Otherwise (if the stream buffer was successfully