Previous fileTop of DocumentContentsIndex pageNext file
Apache C++ Standard Library User's Guide

35.4 Implicit Synchronization by Tying Streams

Another mechanism for automatic synchronization in certain cases is tying a stream to an output stream, as demonstrated in the code below. All input or output operations flush the tied stream's buffer before they perform the actual operation.

//1The input stream istr is tied to the output stream ostr. The tie() member function returns a pointer to the previously tied output stream, or 0 if no output stream is tied.
//2Before any input is done, the tied output stream's buffer is flushed so that the result of previous output operations to ostr is available in the external file /tmp/fil.
//3The previous tie is restored.


Previous fileTop of DocumentContentsIndex pageNext file