iDevGames Forums
redirecting stdout, stderr to console window? - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Game Programming Fundamentals (/forum-7.html)
+--- Thread: redirecting stdout, stderr to console window? (/thread-5163.html)



redirecting stdout, stderr to console window? - WhatMeWorry - Aug 16, 2005 08:36 PM

I've been searching Apple's developer site, but all chaff and no wheat.
I believe the title says it all.

Are there C++ commands or system calls which would map cout and
cerr to the console window?


redirecting stdout, stderr to console window? - OneSadCookie - Aug 16, 2005 08:44 PM

what do you mean?

if you run from the command-line, they'll go to the terminal window that runs the command
if you run from within Xcode, they'll go to Xcode's run log
if you run from the Finder, they'll go to the Console application

isn't that what you want?


redirecting stdout, stderr to console window? - WhatMeWorry - Aug 16, 2005 09:10 PM

I think I stayed on OS 9 way too long.

Tell you the truth, I've been doing #2 (from within Xcode) exclusively. And I have
been using Xcode's run log. Just now trying to branch out.

Ok, stupid question: How does one run an app from the command line?
I presume you open up a terminal window and cd to directory where the app resides.
Then I'm cluless. Though I do see exec, commands, jobs etc. when I type in help.

As for #3 running from the Finder, is that when you just double click on the application
icon? If so, then I think I need to rephrase my original premise: If you double click
on an application icon, the application doesn't start, and the console is empty, what
would be the next thing to try?


redirecting stdout, stderr to console window? - Steven - Aug 16, 2005 09:47 PM

If you want to run it from the terminal (which is a good way to catch debugging output which would cause it to quit unexpectedly):
1) If it's a .app then just run /Users/myname/where/the/app/is/MyApp.app/Contents/MacOS/MyApp from the terminal (of course you can shorten that to a relative path if you want)

2) If it's not a bundle, just execute the file that is the application...


redirecting stdout, stderr to console window? - Fenris - Aug 16, 2005 10:43 PM

...by typing ./myApp.


redirecting stdout, stderr to console window? - WhatMeWorry - Aug 17, 2005 12:12 PM

Thanks for the info! Seems I was trying to start the application file, when I should have been
starting the bundle. Now I see a permissions problem. Off to study permissions Smile