Stream Q

Discussion in 'C++' started by Wouter Lievens, Jul 18, 2003.

  1. I know I can change the behaviour of the clog object to, for example, log to
    a file, using rdbuf().
    Can I change it to do both, meaning dumping to a file and writing to the
    console.

    So I mean, if I call:

    clog << "Foobar" << endl;

    It should write it to the console and write it to a file.
    Wouter Lievens, Jul 18, 2003
    #1
    1. Advertising

  2. "Victor Bazarov" <> schreef in bericht
    news:...
    > "Wouter Lievens" <> wrote...
    > > I know I can change the behaviour of the clog object to, for example,

    log
    > to
    > > a file, using rdbuf().
    > > Can I change it to do both, meaning dumping to a file and writing to the
    > > console.
    > >
    > > So I mean, if I call:
    > >
    > > clog << "Foobar" << endl;
    > >
    > > It should write it to the console and write it to a file.

    >
    > Of course. You just need to implement your own streambuf that
    > would combine the other two.
    >
    > Victor


    Came up with that, doing it now :)
    Thanks
    Wouter Lievens, Jul 18, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rasmusson, Lars
    Replies:
    1
    Views:
    715
    popov
    Apr 30, 2004
  2. Replies:
    9
    Views:
    614
    Alex Buell
    Apr 27, 2006
  3. Alexander Korsunsky

    get stream mode flags from an opened stream

    Alexander Korsunsky, Feb 17, 2007, in forum: C++
    Replies:
    1
    Views:
    442
    John Harrison
    Feb 17, 2007
  4. dolphin
    Replies:
    6
    Views:
    544
    Thomas Fritsch
    Mar 18, 2007
  5. mrstephengross
    Replies:
    3
    Views:
    390
    James Kanze
    May 10, 2007
Loading...

Share This Page