virtual int sync();
The virtual sync function, together with the overflow and underflow functions, defines the characteristics of the streambuf-derived class. Each derived class might implement sync differently, but the interface with the calling stream class is the same.
The sync function flushes the put area. It also empites the get area and, in the process, sends any unprocessed characters back to the source, if necessary.
Returns 0 if the get area is empty and there are no more characters to output; otherwise, it returns EOF.
EOF if an error occurs.