The question is that: how is the right way to handle stdout and stderr on the PSP? I mean, I can't just use pspDebugScreenPrintf, because the libraries that are extern to my program don't use it. So, I fell like I have to redirect the output to files, but as I have seen, it's not a good way to do it.
For example, if I use the following code:
Code: Select all
FILE *fp_out = NULL;
FILE *fp_err = NULL;
void PSP_quit()
{
if (fp_out) {
fclose(fp_out);
}
if (fp_err) {
fclose(fp_err);
}
sceKernelExitGame();
}
int main(int argc, char **argv)
{
[ setup the exit callback... ]
fp_out = freopen("stdout", "w", stdout);
fp_err = freopen("stderr", "w", stderr);
atexit(PSP_quit);
[ run my program, use puts on my Ruby scripts, and so ...]
exit(EXIT_SUCCESS);
}
Code: Select all
i = 0
while i < 100
puts "Iteration #{i.to_s}"
i += 1
end
Code: Select all
Iteration 0
Iteration 1
[...]
Iteration 76
Iterat
EOF
Thank you guys.