std::strstreambuf::overflow (3) - Linux Manuals
std::strstreambuf::overflow: std::strstreambuf::overflow
NAME
std::strstreambuf::overflow - std::strstreambuf::overflow
Synopsis
protected:
virtual int_type overflow (int_type c = EOF);
Appends the character c to the put area of the buffer, reallocating if possible.
1) If c==EOF, does nothing
2) Otherwise, if the put area has a write position available (pptr() < epptr()), stores the character as if by *pptr()++ = c
3) Otherwise, if the stream buffer mode is not dynamic or the stream buffer is currently frozen, the function fails and returns EOF
4) Otherwise, the function reallocates (or initially allocates) a dynamic array large enough to hold the contents of the current dynamic array (if any) plus at least one additional write position. If a pointer to the allocating function palloc was used in the constructor, that function is called with (*palloc)(n) where n is the number of bytes to allocate, otherwise new char[n] is used. If a pointer to the deallocating function pfree was used in the constructor, that function is called with (*pfree)(p) to deallocate the previous array, if needed, otherwise delete[] p is used. If allocation fails, the function fails and returns EOF.
Parameters
c - the character to store in the put area
Return value
If c==EOF, returns some value other than EOF. Otherwise, returns (unsigned char)(c) on success, EOF on failure.
Example
// Run this code
Possible output:
See also
overflow writes characters to the associated output sequence from the put area
[virtual]
overflow appends a character to the output sequence
[virtual]
overflow writes characters to the associated file from the put area
[virtual]
sputc (public member function of std::basic_streambuf<CharT,Traits>)
put (public member function of std::basic_ostream<CharT,Traits>)