GP2X Stderr Doesn't Appear On Gp2x Binary


furyhunter600

Still Fresh
Joined
Sep 29, 2006
Messages
21
Alrighty, new problem at hand; I tried answering this myself on the other topic, but it didn't help.
Let's say I'm going to write a junk string for some reason to stderr:
CODE
fprintf( stderr, "BLAH BLAH JUNK STRING" );

Okay, run the program... aha, in stderr.txt it says "BLAH BLAH JUNK STRING" (without a newline). But stderr.txt only appears on a Windows binary.

How do I make stderr.txt appear on the gp2x binary? As I said, I tried fflush(stderr); after the line which writes the stuff I need to put in stderr, but nothing happens.
 
stderr is a stream not a file, and usually that stream is dumped to the console. It just happens to be that on windows stderr is redirected to stderr.txt instead.
 
different builds of SDL are configured to run a console and some not to run a console.

on GP2X, console is visible only if you start your app FROM a console. you can however redirect console output to a file. if you rebuild sdl you can change it yourself or you could redirect it to a file

in your main() at the top do;
CODE

FILE *fperr;
fperr = freopen("stderr.txt", "wt", stderr)



then before main() quits

CODE

fclose(fperr);
 
ohhh, okay. That makes sense. But now the thing outright crashes o_O

edit: nowait, something else is causing the crash. I'll look for that and then try again.

edit2: okay, it works.
 
Back
Top