ostream_withassign

#include <iostream.h>

The ostream_withassign class is a variant of ostream that allows object assignment. The predefined objects cout, cerr, and clog are objects of this class and thus may be reassigned at run time to a different ostream object. For example, a program that normally sends output to stdout could be temporarily directed to send its output to a disk file.

Predefined Objects

The three predefined objects of class ostream_withassign are connected as follows:

cout

Standard output (file descriptor 1).

cerr

Unit buffered standard error (file descriptor 2).

clog

Fully buffered standard error (file descriptor 2).

Unit buffering, as used by cerr, means that characters are flushed after each insertion operation. The objects cin, cerr, and clog are tied to cout so that use of any of these will cause cout to be flushed.

Construction/Destruction  — Public Members

ostream_withassign

Constructs an ostream_withassign object.

~ostream_withassign

Destroys an ostream_withassign object.

Operators — Public Members

operator =

Assignment operator.

Output Stream Classes

See Also   istream_withassign