redirecting stdout to nowhere

S

Stephane

[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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top