Tools.h++ Class Reference

Table Of Contents
RWbostream can be interrogated as to the stream state using member functions good(), bad(),
eof(), etc.
Persistence
None
Example
See RWbistream for an example of how the file "data.dat" might be read back in.
#include <rw/bstream.h>
#include <fstream.h>
main(){
ofstream fstr("data.dat"); // Open an output file
RWbostream bstr(fstr); // Construct an RWbostream from it
int i = 5;
float f = 22.1;
double d = -0.05;
bstr << i; // Store an int in binary
bstr << f << d; // Store a float & double
}
Public Constructors
RWbostream(streambuf* s);
Construct an RWbostream from the streambuf s. For DOS, the streambuf must have been
opened in binary mode.
RWbostream(ostream& str);
Construct an RWbostream from the streambuf associated with the output stream str. For
DOS, the streambuf must have been opened in binary mode. This can be done by
specifying ios::binary as part of the second argument to the constructor for an ofstream.
Using the example above, the line to create the ofstream would read, ofstream
fstr("data.dat", ios::out | ios::binary); where the "|" is the binary OR operator.
Public Destructor
virtual ~RWvostream();
This virtual destructor allows specializing classes to deallocate any resources that they
may have allocated.