Library: Input/output
ostrstream basic_ostream basic_ios ios_base
char_type freeze() int_type |
off_type ostrstream() pcount() |
pos_type rdbuf() str() |
traits_type ~ostrstream() |
Writes to an array in memory
#include <strstream> namespace std { class ostrstream; }
The class ostrstream writes to an array in memory. It uses a private strstreambuf object to control the associated array object. It inherits from basic_ostream, and therefore can use all the formatted and unformatted output functions.
NOTE -- This is a deprecated feature and might not be available in future versions.
namespace std { class ostrstream : public basic_ostream<char> { public: typedef char char_type; typedef char_traits<char_type> traits_type; typedef typename traits_type::int_type int_type; typedef typename traits_type::pos_type pos_type; typedef typename traits_type::off_type off_type; ostrstream(); ostrstream(char *s, int n, ios_base::openmode = ios_base::out); virtual ~ostrstream(); strstreambuf *rdbuf() const; void freeze(int freezefl = 1); char *str(); int pcount() const; }; }
char_type
The type char_type is a synonym of type char.
int_type
The type int_type is a synonym of type traits_type::in_type.
off_type
The type off_type is a synonym of type traits_type::off_type.
pos_type
The type pos_type is a synonym of type traits_type::pos_type.
traits_type
The type traits_type is a synonym of type char_traits<char>.
ostrstream();
Constructs an object of class ostrstream, initializing the base class basic_ostream with the associated strstreambuf object. The strstreambuf object is initialized by calling its default constructor strstreambuf().
ostrstream(char* s, int n, ios_base::openmode mode = ios_base::out);
Constructs an object of class ostrstream, initializing the base class basic_ostream with the associated strstreambuf object. The strstreambuf object is initialized by calling one of two constructors:
If mode & app == 0, it calls strstreambuf(s,n,s)
Otherwise it calls strstreambuf(s,n,s + ::strlen(s))
virtual ~ostrstream();
Destroys an object of class ostrstream.
void freeze(bool freezefl = true);
Calls rdbuf()->freeze(freezefl).
int pcount() const;
Returns rdbuf()->pcount().
strstreambuf* rdbuf() const;
Returns a pointer to the private strstreambuf object associated with the stream.
char* str();
Returns rdbuf()->str().
See examples for strstream, istrstream, and strstreambuf.
char_traits, ios_base, basic_ios, strstreambuf, istrstream, strstream
Deprecated. See ISO/IEC 14882:1998 -- International Standard for Information Systems --Programming Language C++, Annex D Compatibility features Section D.7.3