Constructing Output Stream Objects

If you use only the predefined cout, cerr, or clog objects, you don’t need to construct an output stream. You must use constructors for:

Output File Stream Constructors

You can construct an output file stream in one of three ways:

Output String Stream Constructors

To construct an output string stream, you can use one of two ostrstream constructors. One dynamically allocates its own storage, and the other requires the address and size of a preallocated buffer.