istrstream class — Input character array streams
class istrstream: public istream { public: explicit istrstream(const char* str); explicit istrstream(char* str); istrstream(const char* str, streamsize n); istrstream(char* str, streamsize n); strstreanbuf* rdbuf( ) const; char* str( ); };
The istrstream
class
represents an input string stream. To construct an istrstream
, pass a character array (with
an optional size). You can then read from the string stream just as
you would from any other input stream.
The following are the methods of istrstream
:
explicit
istrstream
(const char*
str)
, explicit
istrstream
(char*
str)
Initializes an input string stream by constructing an
internal stream buffer as strstreambuf(str
, 0)
and passing the address of the
stream buffer to the base-class constructor for istream
.
explicit
istrstream
(const char* str,
streamsize n)
, explicit
istrstream
(char* str, streamsize
n)
Initializes an input string stream by constructing an
internal stream buffer as strstreambuf(str
, n)
and passing the address of the
stream buffer to the base-class constructor for istream
.
strstreambuf*
rdbuf
( )
const
Returns a pointer to the internal strstreambuf
object.
char*
str
( )
Returns the internal string, rdbuf( )->str( )
.
ostrstream class,
strstream class, strstreambuf class, istream
in <istream>
, istringstream
in <sstream>