Reference
C Library
IOstream Library
Strings library
STL Containers
STL Algorithms
Miscellaneous
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
stringbuf
stringbuf::stringbuf
public members:
stringbuf::str
virtual members:
stringbuf::overflow
stringbuf::pbackfail
stringbuf::seekoff
stringbuf::seekpos
stringbuf::setbuf
stringbuf::underflow


stringbuf

class
<sstream>

String stream buffer

Class hierarchy:
stringbuf

This class applies the functionality of the streambuf class to read and write from/to standard string objects.

Either on construction or by calling member str, the content of a string object is copied into the associated character sequence. Input/Output operations are conducted with a streambuf-compatible interface on this internal copy of the string, not on the original string object with which the object was initialized (if any).

The content of the internal string can be retrieved by calling member str.

Internally, stringbuf objects operate as defined in the streambuf class (see streambuf), with the particularity that the entire content of the string is used as both the controlled input sequence and the controlled output sequence, and made available on its entirety through the internal pointers.

The class overrides some virtual members inherited from streambuf to provide this specific functionality for strings.

Public members


Public members inherited from streambuf:

Virtual protected members


The parent class streambuf defines several protected virtual functions that are called by the other member functions to perform the operations on the associated character sequence. Derived classes override these virtual member functions as necessary to provide the functionality for their specific types of buffer. stringbuf overrides the following:


The remaining virtual protectected members are left with their by-default behavior defined in streambuf.

Protected members

The class also inherits several non-virtual protected members used by the public functions to access the internal pointers. See streambuf for more info.