| View previous topic :: View next topic |
| Author |
Message |
coolkehon
Joined: 20 Oct 2008 Posts: 355
|
Posted: Tue Mar 03, 2009 4:46 am Post subject: [Solved]getting cerr(stderr) to work |
|
|
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
Last edited by coolkehon on Thu Mar 05, 2009 6:04 am; edited 1 time in total |
|
| Back to top |
|
 |
TyRaNiD
Joined: 18 Jan 2004 Posts: 918
|
Posted: Tue Mar 03, 2009 5:23 am Post subject: |
|
|
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. |
|
| Back to top |
|
 |
coolkehon
Joined: 20 Oct 2008 Posts: 355
|
Posted: Tue Mar 03, 2009 5:25 am Post subject: |
|
|
| what if i can get it to just goto a function and i handle it there and also how do i reopen std err because game wont start when i try to do it using sceKernelStderrInstall or when i try todo sceioreopen |
|
| Back to top |
|
 |
coolkehon
Joined: 20 Oct 2008 Posts: 355
|
Posted: Wed Mar 04, 2009 10:17 pm Post subject: |
|
|
| if this question sounds dumb thats because it is but i dont know the answers and that doesnt make me dumb so can some just give me the answer i know its simple i just cant figure it out or find it for that matter |
|
| Back to top |
|
 |
cosmito
Joined: 04 Mar 2007 Posts: 314 Location: Portugal
|
Posted: Wed Mar 04, 2009 10:28 pm Post subject: |
|
|
| How can you claim your question is dumb since you don't know the answer? |
|
| Back to top |
|
 |
coolkehon
Joined: 20 Oct 2008 Posts: 355
|
Posted: Wed Mar 04, 2009 10:29 pm Post subject: |
|
|
| sometimes i'm dumb i search and couldnt find it and i know it has to be simple |
|
| Back to top |
|
 |
Heimdall
Joined: 10 Nov 2005 Posts: 259 Location: Netherlands
|
Posted: Thu Mar 05, 2009 4:43 am Post subject: |
|
|
On C (not C++) I've tried this and it works:
| Code: | /* 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;
}
|
I'd assume that it should work on C++ but I haven't tried it yet. |
|
| Back to top |
|
 |
coolkehon
Joined: 20 Oct 2008 Posts: 355
|
Posted: Thu Mar 05, 2009 5:37 am Post subject: |
|
|
thank you very much that was so simple i tried sceKernelInstallStderr handler and that had to be kernel my app is user and i tried to do sceIoReopen which is also kernel but this works thanks man much obliged
edit: also cerr also prints to the same stream |
|
| Back to top |
|
 |
|