The member function flushBuffer() does exactly this. It writes the characters to the standard
output channel (file descriptor 1) using the function write(). The stream buffer’s member function
pbump() is used to move the write position back to the beginning of the buffer.
The function overflow() inserts the character that caused the call of overflow() into the
buffer if it is not EOF. Then, pbump() is used to advance the write position to reflect the new
end of the buffered characters. This moves the write position beyond the end position (epptr())
temporarily.
This class also features the virtual function sync(), which is used to synchronize the current
state of the stream buffer with the corresponding storage medium. Normally, all that needs to be
done is to flush the buffer. For the unbuffered versions of the stream buffer, overriding this function
was not necessary, because there was no buffer to be flushed.
The virtual destructor ensures that data is written that is still buffered when the stream buffer is
destroyed.
These are the functions that are overridden for most stream buffers. If the external representation
has some special structure, overriding additional functions may be useful. For example, the functions
seekoff() and seekpos() may be overridden to allow manipulation of the write position.