class strstream : public iostream

The strstream class supports I/O streams that have character arrays as a source and destination. You can allocate a character array prior to construction, or the constructor can internally allocate a dynamic array. All the input and output stream operators and functions can then be used to fill the array.

You must be aware that there is a put pointer and a get pointer working independently behind the scenes in the attached strstreambuf class. The put pointer advances as you insert fields into the stream's array, and the get pointer advances as you extract fields. The ostream::seekp function moves the put pointer, and the istream::seekg function moves the get pointer. If either pointer reaches the end of the string (and sets the ios::eof flag), then you must call clear before seeking.

#include <strstrea.h>

See Also

strstreambuf, streambuf, istrstream, ostrstream