Attaching cout || cerr to an ostream

Laurent Marzullo laurent.marzullo@be.sema.com
Fri Feb 23 01:29:00 GMT 2001


Hello all,

Anyone know how to attach cout or cerr (fd 1 or fd 2) to an ostream ?

I was used to do something like this with the old libstdc++ :

------------------------------------------------
	ofstream	l_try;
	string	l_output;

	if ( l_output == "cerr" )
		l_try.attach( 2 );
	else if ( l_output == "cout" )
		l_try.attach( 1 );
	else
		l_try.open( l_output.c_str() );
------------------------------------------------

It's seems that ostream::attach is no more present. How do I achieve
the same thing with libstdc++-v3 ?

Thanks

Laurent Marzullo



More information about the Libstdc++ mailing list