Tools.h++ Manual

104011 Tandem Computers Incorporated 21-151
21
Example See
RWpostream
for an example of how to create an input stream for this
program.
Public constructors
RWpistream(streambuf* s);
Initialize a
RWpistream
from the
streambuf s
.
RWpistream(istream& str);
Initialize a
RWpistream
using the
streambuf
associated with the
istream
str
.
Public member functions
virtual int get();
Redefined from class
RWvistream
. Get and return the next character from the
input stream. Returns EOF if end of file is encountered.
virtual RWvistream& get(char& c);
Redefined from class
RWvistream
. Get the next char and store it in
c
.
virtual RWvistream& get(wchar_t& wc);
Redefined from class
RWvistream
. Get the next wide char and store it in
wc
.
virtual RWvistream& get(unsigned char& c);
Redefined from class
RWvistream
. Get the next unsigned char and store it in
c
.
#include <rw/pstream.h>
main()
{
// Construct a 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
}