ios::tie

Syntax

ostream* tie( ostream* pos );

ostream* tie() const;

Parameters

pos

A pointer to an ostream object.

Remarks

The first overloaded tie function ties this stream to the specified ostream and returns the value of the previous tie pointer (NULL if this stream was not previously tied). A stream tie enables automatic flushing of the ostream in response to (1) a need for more characters or (2) the presence of characters to be consumed.

By default, cin is initially tied to cout so that attempts to get more characters from standard input may result in flushing standard output. In addition, cerr and clog are tied to cout by default.

The second function returns the value of the previous tie pointer (NULL if this stream was not previously tied).