Rogue Wave banner
Previous fileTop of documentContentsIndexNext file

RWpistream


RWpistream-->RWvistream-->RWvios

Data Type and Member Function Indexes
(exclusive of constructors and destructors)

Synopsis

#include <rw/pstream.h>
RWpistream pstr(cin); // Construct an RWpistream, using cin's
                      // streambuf

Description

Class RWpistream specializes the abstract base class RWvistream to restore variables stored in a portable ASCII format by RWpostream.

You can think of RWpistream and RWpostream as an ASCII veneer over an associated streambuf which are responsible for formatting variables and escaping characters such that the results can be interchanged between any machines. As such, they are slower than their binary counterparts RWbistream and RWbostream which are more machine dependent. Because RWpistream and RWpostream retain no information about the state of their associated streambufs, their use can be freely exchanged with other users of the streambuf (such as istream or ifstream).

RWpistream can be interrogated as to the stream state using member functions good(), bad(), eof(), etc.

Persistence

None

Example

See RWpostream for an example of how to create an input stream for this program.

#include <rw/pstream.h>

main(){
   // Construct an RWpistream to use standard input
   RWpistream pstr(cin);

   int i;
   float f;
   double d;
   char string[80];

   pstr >> i;  // Restore an int that was stored in binary
   pstr >> f >> d;  // Restore a float & double
   pstr.getString(string, 80);  // Restore a character string
}
 

Public Constructors

RWpistream(streambuf* s);
RWpistream(istream& str);

Public Operators

virtual RWvistream&
operator>>(char& c);
virtual RWvistream&
operator>>(wchar_t& wc);
virtual RWvistream&
operator>>(double& d);
virtual RWvistream&
operator>>(float& f);
virtual RWvistream&
operator>>(int& i);
virtual RWvistream&
operator>>(long& l);
virtual RWvistream&
operator>>(short& s);
virtual RWvistream&
operator>>(unsigned char& c);
virtual RWvistream&
operator>>(unsigned short& s);
virtual RWvistream&
operator>>(unsigned int& i);
virtual RWvistream&
operator>>(unsigned long& l);
operator void*();

Public Member Functions

virtual int
get();
virtual RWvistream&
get(char& c);
virtual RWvistream&
get(wchar_t& wc);
virtual RWvistream&
get(unsigned char& c);
virtual RWvistream&
get(char* v, size_t N);
virtual RWvistream&
get(wchar_t* v, size_t N);
virtual RWvistream&
get(double* v, size_t N);
virtual RWvistream&
get(float* v, size_t N);
virtual RWvistream&
get(int* v, size_t N);
virtual RWvistream&
get(long* v, size_t N);
virtual RWvistream&
get(short* v, size_t N);
virtual RWvistream&
get(unsigned char* v, size_t N);
virtual RWvistream&
get(unsigned short* v, size_t N);
virtual RWvistream&
get(unsigned int* v, size_t N);
virtual RWvistream&
get(unsigned long* v, size_t N);
virtual RWvistream&
getString(char* s, size_t N);
virtual RWvistream&
getString(wchar_t* ws, size_t N);


Previous fileTop of documentContentsIndexNext file
©Copyright 1999, Rogue Wave Software, Inc.
Send mail to report errors or comment on the documentation.