[comp.lang.c++] istream::tie

leo@atcmp.nl (Leo Willems) (11/24/89)

In our streams library (1.2E Glockenspiel) class istream contains the
member function: ostream* istream::tie(ostream*)

All the manual says is that an ostream is tied to an istream and that
the use of this function is discouraged

What is the use of tie()?

Thanks.


Leo Willems			Internet: leo@atcmp.nl
AT Computing			UUCP:     mcvax!hp4nl!kunivv1!atcmpe!leo
P. O. Box 1428				
6501 BK  Nijmegen		Phone:    +31-80-566880
The Netherlands			Fax:	  +31-80-555887

horstman@sjsumcs.sjsu.edu (Cay Horstmann) (11/26/89)

In article <540@atcmpe.atcmp.nl> leo@atcmp.nl (Leo  Willems) writes:
>
>In our streams library (1.2E Glockenspiel) class istream contains the
>member function: ostream* istream::tie(ostream*)
>
>All the manual says is that an ostream is tied to an istream and that
>the use of this function is discouraged
>
It causes the output stream to flush when an input request comes along.
That way, you can write
	cout << "Please enter ..."; cin >> ...;
and be sure cout gets flushed before the call to cin>>, so the user 
sees the prompt. 

"The use of this function is discouraged" is Glockenspielspeak for 
"The writer of this documentation doesn't understand it either". :-)

Cay