Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ istrstream(3C++) — Sun WorkShop 5.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

char_traits(3C++)

ios_base(3C++)

basic_ios(3C++)

strstreambuf(3C++)

ostrstream(3C++)

strstream(3c++)

istrstream(3C++)

Standard C++ Library
Copyright 1998, Rogue Wave Software, Inc.

 

NAME

 
istrstream
 
 - Reads characters from an array in memory.
 
 
 

SYNOPSIS

 
 
#include <strstream>
class istrstream
: public basic_istream<char>
 
 
 

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<char> and therefore can use all the formatted and unformatted input functions.
 
This is a deprecated feature and might not be available in future versions.
 
 
 

INTERFACE

 
 
 
class istrstream : public basic_istream<char> {
 
public:
 

typedef char_traits<char>             traits;

 

typedef char                         char_type;
typedef typename traits::int_type    int_type;
typedef typename traits::pos_type    pos_type;
typedef typename traits::off_type    off_type;

 

explicit istrstream(const char ∗s);
istrstream(const char ∗s, streamsize n);
explicit istrstream(char ∗s);
istrstream(char ∗s, streamsize n);

 

virtual ~istrstream();

 

strstreambuf ∗rdbuf() const;
char ∗str();

 
};
 
 
 

TYPES

 
 
 
char_type

 
 
The type char_type is a synonym of type char. 
 

 
 
int_type

 
 
The type int_type is a synonym of type traits::in_type. 
 

 
 
off_type

 
 
The type off_type is a synonym of type traits::off_type. 
 

 
 
pos_type

 
 
The type pos_type is a synonym of type traits::pos_type. 
 

 
 
traits

 
 
The type traits is a synonym of type char_traits<char>. 
 

 
 
 

CONSTRUCTORS

 
 
 
explicit istrstream(const char∗ s);
explicit istrstream(char∗ s);

 
 
Constructs an object of class istrstream, initializing the base class basic_istream<char> with the associated strstreambuf object. The strstreambuf object is initialized by calling strstreambuf(s,0), where s designates the first element of an NTBS (null terminated byte string). 
 

 
 
explicit istrstream(const char∗ s, streamsize n);
explicit istrstream(char∗ s, streamsize n);

 
 
Constructs an object of class istrstream, initializing the base class basic_istream<char> with the associated strstreambuf object. The strstreambuf object is initialized by calling strstreambuf(s,n), where s designates the first element of an array whose length is n elements and n is greater than zero. 
 

 
 
 

DESTRUCTORS

 
 
 
virtual ~istrstream();

 
 
Destroys an object of class istrstream. 
 

 
 
 

MEMBER FUNCTIONS

 
 
 
char∗
str();

 
 
Returns a pointer to the underlying array object that may be null.
 

 
 
strstreambuf∗
rdbuf() const;

 
 
Returns a pointer to the private strstreambuf object associated with the stream. 
 

 
 
 

EXAMPLE

 
 
 
//
// stdlib/examples/manual/istrstream.cpp
//
#include<iostream>
#include<strstream>
 
void main ( )
{

using namespace std;

 

const char∗ p="C’est pas l’homme qui prend la mer, ";
const char∗ s="c’est la mer qui prend l’homme";

 

// create an istrstream object and initialize
// the underlying strstreambuf with p

istrstream in_first(p);

 
// create an istrstream object and initialize
// the underlying strstreambuf with s

istrstream in_next(s);

 

// create an ostrstream object

ostrstream out;

 

// output the content of in_first and
// in_next to out

out << in_first.rdbuf() << in_next.str();

 
// output the content of out to stdout

cout << endl << out.rdbuf() << endl;

 

 
// output the content of in_first to stdout

cout << endl << in_first.str();

 

// output the content of in_next to stdout

cout << endl << in_next.rdbuf() << endl;

 
}
 
 
 

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
 
 
 

STANDARDS CONFORMANCE

 
 
ANSI X3J16/ISO WG21 Joint C++ Committee
 

Rogue Wave Software  —  Last change: 02 Apr 1998

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026