cplusplus.com cplusplus.com
cplusplus.com   C++ : Reference : IOstream Library : streambuf : overflow
- -
C++
Information
Documentation
Reference
Articles
Sourcecode
Forum
Reference
C Library
IOstream Library
Strings library
STL Containers
STL Algorithms
IOstream Library
manipulators
classes:
· filebuf
· fstream
· ifstream
· ios
· iostream
· ios_base
· istream
· istringstream
· ofstream
· ostream
· ostringstream
· streambuf
· stringbuf
· stringstream
objects:
· cerr
· cin
· clog
· cout
types:
· fpos
· streamoff
· streampos
· streamsize
streambuf
· streambuf::streambuf
· streambuf::~streambuf
public members:
· streambuf::getloc
· streambuf::in_avail
· streambuf::pubimbue
· streambuf::pubseekoff
· streambuf::pubseekpos
· streambuf::pubsetbuf
· streambuf::pubsync
· streambuf::sbumpc
· streambuf::sgetc
· streambuf::sgetn
· streambuf::snextc
· streambuf::sputbackc
· streambuf::sputc
· streambuf::sputn
· streambuf::sungetc
protected members:
· streambuf::eback
· streambuf::egptr
· streambuf::epptr
· streambuf::gbump
· streambuf::gptr
· streambuf::pbase
· streambuf::pbump
· streambuf::pptr
· streambuf::setg
· streambuf::setp
virtual prot. members:
· streambuf::imbue
· streambuf::overflow
· streambuf::pbackfail
· streambuf::seekoff
· streambuf::seekpos
· streambuf::setbuf
· streambuf::showmanyc
· streambuf::sync
· streambuf::uflow
· streambuf::underflow
· streambuf::xsgetn
· streambuf::xsputn

-

streambuf::overflow virtual protected member function
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.

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).

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> )
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)

© The C++ Resources Network, 2000-2007 - All rights reserved
Spotted an error? - contact us