Archived

This topic is now archived and is closed to further replies.

randomZ

SDL and redirection of standard output

Recommended Posts

I''m using SDL. Normally, it''s supposed to redirect STDOUT and STDERR to the text files stdout.txt and stderr.txt. However, in my project, it seems to do so after its own free will. When I started my project, it did redirect the output. Then, for a long time, it didn''t, and today, all of the sudden, it again started redirecting it. Under what conditions is the output redirected? I have made no code changes to the parts of SDL initialization or the like. BTW, is there a nice C++ way of redirecting cout and cerr to files?
My Wonderful Web Site (C++ SDL OpenGL Game Programming)
I am a signature virus. Please add me to your signature so that I may multiply.

Share this post


Link to post
Share on other sites
To redirect stdout in C you can just do freopen("filename", "w", stdout). This will also redirect the output from the cout command. I don''t know if there''s an "official" C++ way to do it or not. (The same thing works with stderr).

Share this post


Link to post
Share on other sites