Rogue Wave banner
Previous fileTop of documentContentsIndexNext file

RWeostream


...-->ios RWeostream ... ...-->RWbostream-->RWvostream-->RWvios

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

Synopsis

#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);

Description

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.

Persistence

None.

Example

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
}

Enumeration

enum RWeostream::Endian { LittleEndian,
                          BigEndian, 
                          HostEndian }

Public Constructors

RWeostream(streambuf* s, Endian fmt = HostEndian);
RWeostream(ostream& str, Endian fmt = HostEndian);

Public Destructor

virtual ~RWvostream();

Public Member Functions

virtual RWvostream&
flush();
virtual RWvostream&
operator<<(const char* s);
virtual RWvostream&
operator<<(char c);
virtual RWvostream&
operator<<(wchar_t wc);
virtual RWvostream&
operator<<(unsigned char c);
virtual RWvostream&
operator<<(double d);
virtual RWvostream&
operator<<(float f);
virtual RWvostream&
operator<<(int i);
virtual RWvostream&
operator<<(unsigned int i);
virtual RWvostream&
operator<<(long l);
virtual RWvostream&
operator<<(unsigned long l);
virtual RWvostream&
operator<<(short s);
virtual RWvostream&
operator<<(unsigned short s);
virtual RWvostream&
put(char c);
virtual RWvostream&
put(unsigned char c);
virtual RWvostream&
put(const char* p, size_t N);
virtual RWvostream&
put(wchar_t wc);
virtual RWvostream&
put(const wchar_t* p, size_t N);
virtual RWvostream&
put(const unsigned char* p, size_t N);
virtual RWvostream&
put(const short* p, size_t N);
virtual RWvostream&
put(const unsigned short* p, size_t N);
virtual RWvostream&
put(const int* p, size_t N);
virtual RWvostream&
put(const unsigned int* p, size_t N);
virtual RWvostream&
put(const long* p, size_t N);
virtual RWvostream&
put(const unsigned long* p, size_t N);
virtual RWvostream&
put(const float* p, size_t N);
virtual RWvostream&
put(const double* p, size_t N);
virtual RWvostream&
putString(const char*s, size_t N);


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