forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[Solved]getting cerr(stderr) to work

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
coolkehon



Joined: 20 Oct 2008
Posts: 355

PostPosted: Tue Mar 03, 2009 4:46 am    Post subject: [Solved]getting cerr(stderr) to work Reply with quote

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
View user's profile Send private message MSN Messenger
TyRaNiD



Joined: 18 Jan 2004
Posts: 918

PostPosted: Tue Mar 03, 2009 5:23 am    Post subject: Reply with quote

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
View user's profile Send private message
coolkehon



Joined: 20 Oct 2008
Posts: 355

PostPosted: Tue Mar 03, 2009 5:25 am    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
coolkehon



Joined: 20 Oct 2008
Posts: 355

PostPosted: Wed Mar 04, 2009 10:17 pm    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
cosmito



Joined: 04 Mar 2007
Posts: 314
Location: Portugal

PostPosted: Wed Mar 04, 2009 10:28 pm    Post subject: Reply with quote

How can you claim your question is dumb since you don't know the answer?
Back to top
View user's profile Send private message Visit poster's website
coolkehon



Joined: 20 Oct 2008
Posts: 355

PostPosted: Wed Mar 04, 2009 10:29 pm    Post subject: Reply with quote

sometimes i'm dumb i search and couldnt find it and i know it has to be simple
Back to top
View user's profile Send private message MSN Messenger
Heimdall



Joined: 10 Nov 2005
Posts: 259
Location: Netherlands

PostPosted: Thu Mar 05, 2009 4:43 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website MSN Messenger
coolkehon



Joined: 20 Oct 2008
Posts: 355

PostPosted: Thu Mar 05, 2009 5:37 am    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group