The GNU C++ Iostream Library - Synchronization

Node: Synchronization Next: Streambuf from Ios Prev: Extending Up: Ios

Synchronizing related streams

You can use these methods to synchronize related streams with one another:

Method ostream* ios::tie () const
Report on what output stream, if any, is to be flushed before accessing this one. A pointer value of 0 means no stream is tied.

Method ostream* ios::tie (ostream* assoc)
Declare that output stream assoc must be flushed before accessing this stream.

Method int ios::sync_with_stdio ([int switch])
Unless iostreams and C stdio are designed to work together, you may have to choose between efficient C++ streams output and output compatible with C stdio . Use `ios::sync_with_stdio()' to select C compatibility.

The argument switch is a gnu extension; use 0 as the argument to choose output that is not necessarily compatible with C stdio . The default value for switch is 1 .

If you install the stdio implementation that comes with gnu libio , there are compatible input/output facilities for both C and C++. In that situation, this method is unnecessary---but you may still want to write programs that call it, for portability.


Next: Streambuf from Ios Up: Ios