Does anyone know of a way that I can redirect cout to a specific stream, such as a log file? Here's the problem: I'm using a 3rd party 3D graphics library (openscenegraph) that reports errors using cout/cerr. The program I'm writing is an Windows App based on MFC, and as such has no console support. I've tried creating a console class on my own, but that effort has basically bombed out - the examples I have insert a stream directly to the console class, not to cout.

I would like to capture/redirect the cout stream so I can read the errors that the library produces (I really wish OSG would just throw exceptions or provide some sort of base class for error handling that I could use...). My program's error handling system uses exceptions (like a good C++ program should) and stores them in a queue for later printing; it would be easy to add support for streams, assuming I could redirect cout.

Thanks,
Ryan