[comp.lang.c++] HOW DO YOU FREOPEN CIN, COUT AND CERR ?

ger@prisma.cv.ruu.nl (Ger Timmens) (08/28/90)

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,

+===========================================================+
| Ger Timmens, 3 Dimensional Computer Vision Research Group |
|      Academical Hospital Utrecht, Heidelberglaan 100      |
| 3584 CX  Utrecht, THE NETHERLANDS, e-mail: ger@cv.ruu.nl  |
|       Tel.No.: +31-30-506711, Fax.No.: +31-30-513399      |
+-----------------------------------------------------------+
|              Delft, University of Technology              |
|      Faculty of Technical Mathematics and Informatics     |
|                Section of Applied Analysis                |
+===========================================================+

mat@mole-end.UUCP (Mark A Terribile) (09/08/90)

In article <ger.651858984@prisma>, 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