.\" ident @(#)istrstream.3 .\" Standard Template Library .\" $$RW_INSERT_HEADER "slyrs.man" .TH istrstream 3C++ "02 Apr 1998" "Rogue Wave Software" "-" .ce2 Standard C++ Library Copyright 1998, Rogue Wave Software, Inc. .SH NAME \f2istrstream\fP \ - Reads characters from an array in memory. .SH SYNOPSIS .br #include .br class istrstream .br : public basic_istream .SH DESCRIPTION The class istrstream reads characters from an array in memory. It uses a private strstreambuf object to control the associated array object. It inherits from basic_istream and therefore can use all the formatted and unformatted input functions. This is a deprecated feature and might not be available in future versions. .SH INTERFACE .br class istrstream : public basic_istream { .br .br public: .br .RE .RS 1 typedef char_traits traits; .RE .RS 4 .RE .RS 1 typedef char char_type; .br typedef typename traits::int_type int_type; .br typedef typename traits::pos_type pos_type; .br typedef typename traits::off_type off_type; .RE .RS 0 .RE .RS 1 explicit istrstream(const char *s); .br istrstream(const char *s, streamsize n); .br explicit istrstream(char *s); .br istrstream(char *s, streamsize n); .RE .RS 0 .RE .RS 1 virtual ~istrstream(); .RE .RS 0 .RE .RS 1 strstreambuf *rdbuf() const; .br char *str(); .RE .RS 0 .br }; .SH TYPES .br char_type .RE .RS 3 The type \f2char_type\fP is a synonym of type \f2char\fP. .RE .br int_type .RE .RS 3 The type \f2int_type\fP is a synonym of type \f2traits::in_type\fP. .RE .br off_type .RE .RS 3 The type \f2off_type\fP is a synonym of type \f2traits::off_type\fP. .RE .br pos_type .RE .RS 3 The type \f2pos_type\fP is a synonym of type \f2traits::pos_type\fP. .RE .br traits .RE .RS 3 The type \f2traits\fP is a synonym of type \f2char_traits\fP. .RE .SH CONSTRUCTORS .br explicit istrstream(const char* s); .br explicit istrstream(char* s); .RE .RS 3 Constructs an object of class \f2istrstream\fP, initializing the base class \f2basic_istream \fPwith the associated \f2strstreambuf\fP object. The \f2strstreambuf\fP object is initialized by calling \f2strstreambuf(s,0)\fP, where \f2s\fP designates the first element of an NTBS (null terminated byte string). .RE .br explicit istrstream(const char* s, streamsize n); .br explicit istrstream(char* s, streamsize n); .RE .RS 3 Constructs an object of class \f2istrstream\fP, initializing the base class \f2basic_istream\fP with the associated \f2strstreambuf\fP object. The \f2strstreambuf\fP object is initialized by calling \f2strstreambuf(s,n)\fP, where \f2s\fP designates the first element of an array whose length is \f2n\fP elements and \f2n\fP is greater than zero. .RE .SH DESTRUCTORS .br virtual ~istrstream(); .RE .RS 3 Destroys an object of class \f2istrstream\fP. .RE .SH MEMBER FUNCTIONS .br char* .br str(); .RE .RS 3 Returns a pointer to the underlying array object that may be null. .RE .br strstreambuf* .br rdbuf() const; .RE .RS 3 Returns a pointer to the private \f2strstreambuf\fP object associated with the stream. .RE .SH EXAMPLE .br // .br // stdlib/examples/manual/istrstream.cpp .br // .br #include .br #include .br .br void main ( ) .br { .RE .RS 1 using namespace std; .RE .RS 0 .RE .RS 1 const char* p="C'est pas l'homme qui prend la mer, "; .br const char* s="c'est la mer qui prend l'homme"; .RE .RS 0 .RE .RS 2 // create an istrstream object and initialize .br // the underlying strstreambuf with p .RE .RS 1 istrstream in_first(p); .RE .RS 2 .br // create an istrstream object and initialize .br // the underlying strstreambuf with s .RE .RS 1 istrstream in_next(s); .RE .RS 0 .RE .RS 2 // create an ostrstream object .RE .RS 1 ostrstream out; .RE .RS 0 .RE .RS 2 // output the content of in_first and .br // in_next to out .RE .RS 1 out << in_first.rdbuf() << in_next.str(); .RE .RS 2 .br // output the content of out to stdout .RE .RS 1 cout << endl << out.rdbuf() << endl; .RE .RS 0 .RE .RS 2 .br // output the content of in_first to stdout .RE .RS 1 cout << endl << in_first.str(); .RE .RS 0 .RE .RS 2 // output the content of in_next to stdout .RE .RS 1 cout << endl << in_next.rdbuf() << endl; .RE .RS 0 .br } .SH SEE ALSO char_traits(3C++), ios_base(3C++), basic_ios(3C++), strstreambuf(3C++), ostrstream(3C++), strstream(3c++) Working Paper for Draft Proposed International Standard for Information Systems--Programming Language C++, Annex D Compatibility features Section D.6.2 .SH STANDARDS CONFORMANCE ANSI X3J16/ISO WG21 Joint C++ Committee