I've got a library that is annoying me. When I command it to do what I need it to do, it spits out a bunch of text onto the screen that I don't need.
Is there a way to temporarily "mute" a console program, then re enable it later?

This is what I have found from Google:

std::streambuf* cout_sbuf = std::cout.rdbuf(); // save original sbuf
    std::ofstream   fout("/dev/null");
    std::cout.rdbuf(fout.rdbuf()); // redirect 'cout' to a 'fout'
  std::cout.rdbuf(cout_sbuf); // restore the original stream buffer

But that comes up with TONS of errors.

Any ideas? Thanks guys :)

8 Years
Discussion Span
Last Post by mybluehair

I would but the problem is that all the stuff that gets printed out is really ugly and takes like ten seconds to finish


it's Curl. Can't get it to invisibly download a file + disconnect from the file after its downloaded.

I can invisibly download the file, but when I try to use the info in the downloaded file later on in my program, it doesn't let me because it's still opened by Curl.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.