This is the mail archive of the
libstdc++@sourceware.cygnus.com
mailing list for the libstdc++ project.
Re: Redirecting cerr, cout to a file.
- To: Benjamin Kosnik <bkoz at cygnus dot com>
- Subject: Re: Redirecting cerr, cout to a file.
- From: Matt Austern <austern at sgi dot com>
- Date: Fri, 14 Apr 2000 15:06:39 -0700 (PDT)
- Cc: "George T. Talbot" <george at moberg dot com>, libstdc++ List <libstdc++ at sourceware dot cygnus dot com>
- References: <38F78ECA.2BB4E87F@moberg.com><Pine.SOL.3.91.1000414145756.18817A-100000@cse.cygnus.com>
- Reply-To: austern at sgi dot com
Benjamin Kosnik writes:
>
> > I looked in the FAQ for v3, and this one wasn't in there. I'm using
> > assignment in my program to redirect cerr and cout to a file. I do this for
> > debugging purposes, as the program uses fork().
>
> please provide a code snippet that demonstrates what you are trying to
> do, and what you expect, and what you think is broken
Nothing is broken. The original message says "I'm using assignment"
to redirect cerr and cout, and standard streams have no assignment
operator. Class basic_ios explicitly makes operator= private and
undefined.
The standard way of doing this is to open up a filebuf, and reset cout
and cerr's streambuf using rdbuf.