Jump to content
  • Advertisement


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


SDL and redirection of standard output

This topic is 5556 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!