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.
A program that normally sends output to stdout, for example, could be temporarily directed to send its output to a disk file.
There are three predefined objects of class ostream_withassign. They 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.
#include <iostream.h>
istream_withassign