i want to get stderr to work how do i get it to work and also is there a way to tell the calling function of a funtions line number, file, etc for example
void function1()
{
tellErr();
}
void tellErr()
{
cerr << __CALLINGFUNCTION__ << endl;
}
the main point of this is to get cerr working just to make a note and then i want to get that second one working but order doesnt matter
[Solved]getting cerr(stderr) to work
[Solved]getting cerr(stderr) to work
Last edited by coolkehon on Thu Mar 05, 2009 6:04 am, edited 1 time in total.
Erm where do you want it to go exactly? If it is to the psp's screen then you would have to implement your own stream to handle it, if you want it to a file you should be able to reopen the C libraries stderr handle, if you want it to a terminal get psplink.
As for calling function info etc. I don't think you can on GCC, at least not in any sensible way.
As for calling function info etc. I don't think you can on GCC, at least not in any sensible way.
On C (not C++) I've tried this and it works:
I'd assume that it should work on C++ but I haven't tried it yet.
Code: Select all
/* freopen example: redirecting stdout */
#include <stdio.h>
int main ()
{
freopen ("stdout.txt","w",stdout);
freopen ("stderr.txt","w",stderr);
printf ("This sentence is redirected to a file.");
fclose (stdout);
fclose (stderr);
return 0;
}