redirecting stdout to nowhere

Discussion in 'C++' started by Stephane, Mar 6, 2005.

  1. Stephane

    Stephane Guest

    [VC7.1 Windows XP]
    hi,

    I'm using a 3rd party library producing output to stdout.
    As I'm developpong a console application, it is really annoying.
    I found a way to bypass it:
    //saving the old stdout stream
    std::streambuf* oldcoutbuf = std::cout.rdbuf();
    //setting the cout stream to NULL
    std::cout.rdbuf(NULL);
    //calling the annoying code
    ThirdPartyCodeProducingAnnoyingCouts();
    //restoring the cout stream
    std::cout.rdbuf(oldcoutbuf);

    is it safe to do it like that ?
    if not, how should I handle it ?

    Thanks for your help.

    Stephane
    http://www.exotk.org
    Stephane, Mar 6, 2005
    #1
    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. Michael Borgwardt

    Empty stack trace/method call from nowhere?

    Michael Borgwardt, Sep 29, 2004, in forum: Java
    Replies:
    3
    Views:
    650
    Michael Borgwardt
    Sep 29, 2004
  2. Werner Lehmann

    Default timezone changes out of nowhere?

    Werner Lehmann, Jun 30, 2005, in forum: Java
    Replies:
    6
    Views:
    10,561
    Werner Lehmann
    Jul 2, 2005
  3. Richard Kessler

    sys.path - stuff from nowhere?

    Richard Kessler, Jul 22, 2005, in forum: Python
    Replies:
    0
    Views:
    274
    Richard Kessler
    Jul 22, 2005
  4. Elad
    Replies:
    0
    Views:
    409
  5. Replies:
    0
    Views:
    325
Loading...

Share This Page