다음을 통해 공유


istrstream Class

 

The latest version of this topic can be found at istrstream Class.

Describes an object that controls extraction of elements and encoded objects from a stream buffer of class strstreambuf.

Syntax

class istrstream : public istream

Remarks

The object stores an object of class strstreambuf.

Note

This class is deprecated. Consider using istringstream or wistringstream instead.

Constructors

istrstream Constructs an object of type istrstream.

Member Functions

rdbuf Returns a pointer to the stream's associated strstreambuf object.
str Calls freeze, and then returns a pointer to the beginning of the controlled sequence.

Requirements

Header: <strstream>

Namespace: std

istrstream::istrstream

Constructs an object of type istrstream.

explicit istrstream(
    const char* ptr);

explicit istrstream(
    char* ptr);

istrstream(
    const char* ptr,
    streamsize count);

istrstream(
    char* ptr,
    int count);

Parameters

count
The length of the buffer ( ptr).

ptr
The contents with which the buffer is initialized.

Remarks

All the constructors initialize the base class by calling istream( sb), where sb is the stored object of class strstreambuf. The first two constructors also initialize sb by calling strstreambuf( ( constchar *) ptr, 0 ). The remaining two constructors instead call strstreambuf( ( constchar *) ptr, count ).

istrstream::rdbuf

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

strstreambuf *rdbuf
() const

Return Value

A pointer to the stream's associated strstreambuf object.

Remarks

The member function returns the address of the stored stream buffer, of type pointer to strstreambuf.

Example

See strstreambuf::pcount for a sample that uses rdbuf.

istrstream::str

Calls freeze, and then returns a pointer to the beginning of the controlled sequence.

char *str();

Return Value

A pointer to the beginning of the controlled sequence.

Remarks

The member function returns rdbuf -> str.

Example

See strstream::str for a sample that uses str.

See Also

istream
Thread Safety in the C++ Standard Library
iostream Programming
iostreams Conventions