protected virtual member function


int overflow (int c = EOF);
Put character on overflow
Writes the contents of the intermediate output buffer to the associated file, followed by c (unless c is EOF).

The function uses codecvt::out to convert the characters out with the proper facet. It then updates the pointers that define the intermediate output buffer (pptr, epptr and pbase) in such a way that the characters written to the file are not part of it, and -possibly- writing positions are made available at the put pointer (pptr).

If the function cannot write the characters, it returns the end-of-file value (EOF) to signal failure.

This function is called by public member functions of its base class such as sputc to put a character when there are no writing positions available at the put pointer (pptr).

This member function overrides the inherited virtual member streambuf::overflow.


Character to be put.
If this is the end-of-file value (EOF), no character is put, but the other effects of calling this function are attempted.

Return Value

In case of success, the character put is returned, as a value of type int.
Otherwise, it returns the end-of-file value (EOF) either if called with this value as argument c or to signal a failure (some implementations may throw an exception instead).

Data races

Modifies the filebuf object.
Concurrent access to the same file stream buffer object may introduce data races.

Exception safety

Basic guarantee: if an exception is thrown, the file stream buffer is in a valid state.

See also