|
|
#include <strstream.h>class ios { public: enum open_mode { in, out, ate, app, trunc, nocreate, noreplace }; // and lots of other stuff, see ios(C++) ... } ;
class strstreambase : public virtual ios { ... } ;
class istrstream : public istream { public: istrstream(char*) ; istrstream(char*, int) ; strstreambuf* rdbuf() ; } ;
class ostrstream : public ostream { public: ostrstream(); ostrstream(char*, int, int=ios::out) ; int pcount() ; strstreambuf* rdbuf() ; char* str(); };
class strstream : public strstreambase, public iostream { public: strstream(); strstream(char*, int, int mode); strstreambuf* rdbuf() ; char* str(); };
strstream
specializes iostream
for ``incore'' operations, that is, storing and fetching from arrays of bytes.
The streambuf
associated with a strstream
is a
strstreambuf
(see
ssbuf(C++)).
In the following descriptions assume:
strstream
istrstream
ostrstream
char*
int
representing an open_mode
int
s
strstreambuf*
istrstream(
cp)
istream::seekg()
) are allowed within that space.
istrstream(
cp,
len)
istream::seekg()
) are allowed anywhere within that array.
ostrstream()
ostrstream(
cp,
n,
mode)
ios::ate
or ios::app
is set in mode,
cp is assumed to be a null-terminated string
and storing will begin at the null character.
Otherwise storing will begin at cp.
Seeks are allowed anywhere in the array.
strstream()
strstream(
cp,
n,
mode)
ios::ate
or ios::app
is set in mode,
cp is assumed to be a null-terminated string
and storing will begin at the null character.
Otherwise storing will begin at cp.
Seeks are allowed anywhere in the array.
Note that, if mode is set to ios::in|ios::out
,
the original string (if any) stored at cp will not be
accessible unless seeks (ostream::seekp()
) are used to
adjust the put pointer.
=
iss.rdbuf()
strstreambuf
associated with iss.
=
oss.rdbuf()
strstreambuf
associated with oss.
=
oss.str()
str
has been called the effect of storing
more characters into oss is undefined.
If oss was constructed with an explicit array,
cp is just a pointer to the array.
Otherwise, cp points
to a dynamically allocated area.
Until str
is called, deleting the dynamically allocated area is
the responsibility of oss.
After str
returns, the array becomes the responsibility
of the user program.
=
oss.pcount()
.str()
does not point to a null terminated string.
=
ss.rdbuf()
strstreambuf
associated with ss.
=
ss.str()
str
has been called the effect of storing
more characters into ss is undefined.
If ss was constructed with an explicit array,
cp is just a pointer to the array.
Otherwise, cp points to a dynamically allocated area.
Until str
is called, deleting the dynamically allocated area is
the responsibility of ss.
After str
returns, the array becomes the responsibility
of the user program.