...ios RWeostream ... ...RWbostreamRWvostreamRWvios
Data Types |
enum |
Member Functions |
flush() operator<<() put() putString() |
#include <rw/estream.h> // Construct an RWeostream that uses cout's streambuf, // and writes out values in little-endian format: RWeostream estr(cout, RWeostream::LittleEndian);
Class RWeostream specializes the base class RWbostream to store values in a portable binary format. The results can be restored via its counterpart, RWeistream.
See the entry for RWeistream for a general description of the endian stream classes.
None.
See RWeistream for an example of how the file "data.dat" might be read.
#include <rw/estream.h> #include <fstream.h> main() { ofstream fstr("data.dat"); // Open an output file RWeostream estr(fstr); // Construct an RWeostream from it // (For DOS: RWeistream estr(fstr, ios::binary) int i = 5; float f = 22.1; double d = -0.05; estr << i; // Store an int, float, and double estr << f << d; // using the native endian format }
enum RWeostream::Endian { LittleEndian, BigEndian, HostEndian }
Used to specify the format that RWeostreams should use to represent numeric values in the stream. HostEndian means to use the native format of the current environment.
RWeostream(streambuf* s, Endian fmt = HostEndian);
Construct an RWeostream from the streambuf s. Values placed into the stream will have an endian format given by fmt. For DOS, the streambuf must have been created in binary mode. Throw exception RWStreamErr if streambuf s is not empty.
RWeostream(ostream& str, Endian fmt = HostEndian);
Construct an RWeostream from the streambuf associated with the output stream str. Values placed into the stream will have an endian format given by fmt. For DOS, the str must have been opened in binary mode. Throw exception RWStreamErr if streambuf s is not empty.
virtual ~RWvostream();
This virtual destructor allows specializing classes to deallocate any resources that they may have allocated.
virtual RWvostream& flush();
Send the contents of the stream buffer to output immediately.
virtual RWvostream& operator<<(const char* s);
Redefined from class RWbostream. Store the character string starting at s to the output stream. The character string is expected to be null terminated. Note that the elements of s are treated as characters, not as numbers.
virtual RWvostream& operator<<(char c);
Redefined from class RWbostream. Store the char c to the output stream. Note that c is treated as a character, not a number.
virtual RWvostream& operator<<(wchar_t wc);
Redefined from class RWbostream. Store the wchar_t wc to the output stream in binary, using the appropriate endian representation.
virtual RWvostream& operator<<(unsigned char c);
Redefined from class RWbostream. Store the unsigned char c to the output stream. Note that c is treated as a character, not a number.
virtual RWvostream& operator<<(double d);
Redefined from class RWbostream. Store the double d to the output stream in binary, using the appropriate endian representation.
virtual RWvostream& operator<<(float f);
Redefined from class RWbostream. Store the float f to the output stream in binary, using the appropriate endian representation.
virtual RWvostream& operator<<(int i);
Redefined from class RWbostream. Store the int i to the output stream in binary, using the appropriate endian representation.
virtual RWvostream& operator<<(unsigned int i);
Redefined from class RWbostream. Store the unsigned int i to the output stream in binary, using the appropriate endian representation.
virtual RWvostream& operator<<(long l);
Redefined from class RWbostream. Store the long l to the output stream in binary, using the appropriate endian representation.
virtual RWvostream& operator<<(unsigned long l);
Redefined from class RWbostream. Store the unsigned long l to the output stream in binary, using the appropriate endian representation.
virtual RWvostream& operator<<(short s);
Redefined from class RWbostream. Store the short s to the output stream in binary, using the appropriate endian representation.
virtual RWvostream& operator<<(unsigned short s);
Redefined from class RWbostream. Store the unsigned short s to the output stream in binary, using the appropriate endian representation.
virtual RWvostream& put(char c); virtual RWvostream& put(unsigned char c); virtual RWvostream& put(const char* p, size_t N);
Inherited from class RWbostream.
virtual RWvostream& put(wchar_t wc);
Redefined from class RWbostream. Store the wchar_t wc to the output stream in binary, using the appropriate endian representation.
virtual RWvostream& put(const wchar_t* p, size_t N);
Redefined from class RWbostream. Store the vector of wchar_ts starting at p to the output stream in binary, using the appropriate endian representation.
virtual RWvostream& put(const unsigned char* p, size_t N);
Redefined from class RWbostream. Store the vector of unsigned chars starting at p to the output stream in binary, using the appropriate endian representation.
virtual RWvostream& put(const short* p, size_t N);
Redefined from class RWbostream. Store the vector of shorts starting at p to the output stream in binary, using the appropriate endian representation.
virtual RWvostream& put(const unsigned short* p, size_t N);
Redefined from class RWbostream. Store the vector of unsigned shorts starting at p to the output stream in binary, using the appropriate endian representation.
virtual RWvostream& put(const int* p, size_t N);
Redefined from class RWbostream. Store the vector of ints starting at p to the output stream in binary, using the appropriate endian representation.
virtual RWvostream& put(const unsigned int* p, size_t N);
Redefined from class RWbostream. Store the vector of unsigned ints starting at p to the output stream in binary, using the appropriate endian representation.
virtual RWvostream& put(const long* p, size_t N);
Redefined from class RWbostream. Store the vector of longs starting at p to the output stream in binary, using the appropriate endian representation.
virtual RWvostream& put(const unsigned long* p, size_t N);
Redefined from class RWbostream. Store the vector of unsigned longs starting at p to the output stream in binary, using the appropriate endian representation.
virtual RWvostream& put(const float* p, size_t N);
Redefined from class RWbostream. Store the vector of floats starting at p to the output stream in binary, using the appropriate endian representation.
virtual RWvostream& put(const double* p, size_t N);
Redefined from class RWbostream. Store the vector of doubles starting at p to the output stream in binary, using the appropriate endian representation.
virtual RWvostream& putString(const char*s, size_t N);
Store the character string, including embedded nulls, starting at s to the output string.