PDA

View Full Version : redirecting stdout, stderr to console window?


WhatMeWorry
2005.08.17, 12:36 AM
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?

OneSadCookie
2005.08.17, 12:44 AM
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?

WhatMeWorry
2005.08.17, 01:10 AM
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?

Steven
2005.08.17, 01:47 AM
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...

Fenris
2005.08.17, 02:43 AM
...by typing ./myApp.

WhatMeWorry
2005.08.17, 04: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 :)