Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!julius.cs.uiuc.edu!ux1.cso.uiuc.edu!iuvax!att!hriso!attdso!westmark!mole-end!mat From: mat@mole-end.UUCP (Mark A Terribile) Newsgroups: comp.lang.c++ Subject: Re: HOW DO YOU FREOPEN CIN, COUT AND CERR ? Summary: You don't ... exactly Keywords: freopen Message-ID: <435@mole-end.UUCP> Date: 8 Sep 90 04:38:54 GMT References: Distribution: comp.lang.c++ Organization: mole-end--private system. admin: mole-end!newtnews Lines: 26 In article , ger@prisma.cv.ruu.nl (Ger Timmens) writes: > > Does anybody out there know how you can reopen > cin, cout and cerr in c++ ? > The second 'problem' we came across is the fact > that cerr seems to be attached to both stderr and > stdout. > We are working with Sun's AT&T C++ version 2.0. > > Thanks in advance, You've got 2.0--whew! Well, those are of type ostream_with_assign . This is an ostream to which you can assign, which is to say that internally it somehow points at the `real' ostream, or at least the real streambuf. It should be possible, then, to create the stream you want, and `assign' it (with operator=() ) to the standard stream that you want to replace. But tell me, please, what do you mean when you say that cerr is attached to both stderr and stdout ? Does an insertion or write to cerr put characters on both stderr and cerr ? I haven't observed anything like this. -- (This man's opinions are his own.) From mole-end Mark Terribile