ostrstream

#include <strstrea.h>

The ostrstream class supports output streams that have character arrays as a destination. You can allocate a character array prior to construction, or the constructor can internally allocate an expandable array. You can then use all the ostream operators and functions to fill the array.

Be aware that there is a put pointer working behind the scenes in the attached strstreambuf class. This pointer advances as you insert fields into the stream’s array. The only way you can make it go backward is to use the ostream::seekp function. If the put pointer reaches the end of user-allocated memory (and sets the ios::eof flag), you must call clear before seekp.

Construction/Destruction — Public Members

ostrstream

Constructs an ostrstream object.

~ostrstream

Destroys an ostrstream object.

Other Functions — Public Members

pcount

Returns the number of bytes that have been stored in the stream’s buffer.

rdbuf

Returns a pointer to the stream’s associated strstreambuf object.

str

Returns a character array pointer to the string stream’s contents and freezes the array.

Output Stream Classes

See Also   strstreambuf, streambuf, strstream, istrstream