using std::freopen to redirect stderr c++

Posted by chriscisco on Stack Overflow See other posts from Stack Overflow or by chriscisco
Published on 2012-10-28T04:56:29Z Indexed on 2012/10/28 5:00 UTC
Read the original article Hit count: 113

Filed under:
|

So I want to redirect all stderr to a file, which is also being used by my logger for the entire time the application (game) is running.

The follow redirect it away from the console, but it never appears in my file, and using fclose after the game loop is over doesnt actually do anything, where it would normally would.

freopen(Logger::logFile.c_str(),"a",stderr);

Any help would be great on how to get stderr to output to the text file, in a game loop.

© Stack Overflow or respective owner

Related posts about c++

Related posts about io