The GNU C++ Iostream Library



3.4: Input and output together: class iostream

If you need to use the same stream for input and output, you can use an object of the class iostream, which is derived from both istream and ostream.


The constructors for iostream behave just like the constructors for istream.


Constructor:  iostream::iostream ()

When used without arguments, the iostream constructor simply allocates a new ios object, and initializes the input counter (the value reported by istream::gcount) to 0.

Constructor:  iostream::iostream (streambuf* sb [, ostream* tie])

You can also call a constructor with one or two arguments. The first argument sb is a streambuf*; if you supply this pointer, the constructor uses that streambuf for input and output.

You can use the optional second argument tie (an ostream*) to specify a related output stream as the initial value for ios::tie.

As for ostream and istream, iostream simply uses the ios destructor. However, an iostream is not deleted by its destructor.

You can use all the istream, ostream, and ios methods with an iostream object.



Translated 02/24/96 by Rance Necaise. Original texi file by Bothner and Pesch.