#include <strstrea.h>
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. You can then use all the input and output stream operators and functions to fill the array.
Be aware that a put pointer and a get pointer are 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), you must call clear before seeking.
Construction/Destruction — Public Members
Constructs a strstream object.
Destroys a strstream object.
Other Functions — Public Members
Returns the number of bytes that have been stored in the stream’s buffer.
Returns a pointer to the stream’s associated strstreambuf object.
Returns a pointer to the string stream’s character buffer and freezes it.
See Also strstreambuf, streambuf, istrstream, ostrstream