protected virtual member function
<streambuf>
int overflow ( int c = EOF );
Write character in the case of overflow
For the purpose of the
streambuf class,
overflows happen when a new character is to be written at the
put pointer pptr position, but this has reached the
end pointer epptr, indicating that apparently no room is currently available at the
internal output array.
This function is expected either to modify the
pbase,
pptr and
epptr pointers that define the
internal output array in such a way that room is made available for more characters, or otherwise fail. It is also responsibility of the function to write the character passed as argument.
The specific behavior depends on each derived class, but it normally attempts to write some of the characters to the
controlled output sequence to make room for more characters in the
internal output array. Its default behavior in
streambuf is to do nothing and return EOF (or
traits::eof() for other traits), although it may be overloaded in derived classes such as
filebuf (see
filebuf::overflow).
This protected member function is automatically called by
sputc and
sputn member functions when overflows happen.
Parameters
- c
- Character to be written.
Return Value
A value different than
EOF (or
traits::eof() for other traits) signals success.
If the function fails, either
EOF (or
traits::eof() for other traits) is returned or an exception is thrown.
Basic template member declaration
( basic_streambuf<charT,traits> )
1 2
|
typedef traits::int_type int_type;
int_type overflow ( int_type c = traits::eof() );
|
See also.
- streambuf::sputc
- Store character at current put position and increase put pointer (public member function)
- streambuf::sputn
- Write a sequence of characters (public member function)