The Microsoft Input/Output Stream Classes (iostream.hlp) (Table of Contents; Topic list)
class ostream
ios                                         Up Contents Index Back
──The Microsoft iostream Classes────────────────────────────────────────────
 
  Description
 
  The ostream class provides the basic capability for sequential and
  random-access output. An ostream object has a streambuf-derived object
  attached, and the two classes work together; the ostream class does the
  formatting, and the streambuf class does the low-level buffered output.
 
  You can use ostream objects for sequential disk output if you first
  construct an appropriate filebuf object. (The filebuf class is derived
  from streambuf.) More often, you will use the predefined stream objects
  cout, cerr, and clog (actually objects of class ostream_withassign), or
  you will use objects of classes ofstream (disk file streams) and
  ostrstream (string streams).
 
  All of the ostream member functions write unformatted data; formatted
  output is handled by the insertion operators.
 
  Derivation
 
  It is not always necessary to derive from ostream to add functionality
  to a stream; consider deriving from streambuf instead, as illustrated on
  in Chapter 19 of the <Class Libraries User's Guide>. The ofstream and
  ostrstream classes are examples of ostream-derived classes that
  construct member objects of predetermined derived streambuf classes.
 
  You can add manipulators without deriving a new class.
 
  If you add new insertion operators for a derived ostream class, then the
  rules of C++ dictate that you must reimplement all the base class
  insertion operators. If, however, you reimplement the operators through
  inline equivalence, no extra code will be generated. For example,
 
  class xstream : public ostream
  {
  public:
      // Constructors, etc.
      // ........
      inline xstream& operator << ( char ch ) // insertion for char
      {
            return (xstream&)ostream::operator << ( ch );
      }
      // ........
      // Insertions for other types
  };
 
  #include <iostream.h>
 
  See Also
 
  streambuf, ofstream, ostrstream, cout, cerr, clog
 
  Public Members
 
  Construction/Destruction
 
  ostream   Constructs an ostream object that is attached to an existing
              streambuf object.
 
  ~ostream   Destroys an ostream object.
 
  Prefix/Suffix Functions
 
  opfx   Output prefix function, called prior to insertion operations to
           check for error conditions, and so forth.
 
  osfx   Output suffix function, called after insertion operations;
           flushes the stream's buffer if it is unit buffered.
 
  Unformatted Output
 
  put     Inserts a single byte into the stream.
 
  write   Inserts a series of bytes into the stream.
 
  Other Functions
 
  flush   Flushes the buffer associated with this stream.
 
  seekp   Changes the stream's put pointer.
 
  tellp   Gets the value of the stream's put pointer.
 
  Operators
 
  operator <<   An insertion operator for various types.
 
  Manipulators
 
  endl    Inserts a newline sequence and flushes the buffer.
 
  ends    Inserts a null character to terminate a string.
 
  flush   Flushes the stream's buffer.
 
 
                                     -♦-