Skip to main content
GameDev.net gamedev.net
🔒 Locked

SDL stdout redirection

Started by swinchen Aug 23, 2005 at 3:29 PM 3 replies 4.2k views
Original Post
swinchen
swinchen
Hi all, Is there any way to set stdout back to the console? I tried this: FILE* oldStdout; *oldStdout = *stdout; //Causes the window app to crash. bummer. SDL_Init(...); fclose(stdout); *stdout = *oldStdout; Hrmmmm... Thanks.
qbic
qbic
I haven't tried this anytime but this is the solution that comes to my mind:

FILE *stdoutBackup;FILE *sdloutBackup;// InitstdoutBackup = stdout;SDL_Init();sdloutBackup = stdout;stdout = stdoutBackup;....// At exitstdout = sdloutBackup;SDL_Quit();
Jezper Blixt
baumep
baumep
Hi, not a direct answer but take a look at this thread (Annoying Problem (SDL Related?)) with a similar problem. Maybe you can use the solution suggested at the end of the thread.
baumep
Oluseyi
Oluseyi
Edit: My apologies, I thought this thread was posted by the same person. Re-opened.

A Windows-only solution is detailed here.

Sorry about the mix-up.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.