redirecting stdout, stderr to console window?

Member
Posts: 321
Joined: 2004.10
Post: #1
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?
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
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?
Quote this message in a reply
Member
Posts: 321
Joined: 2004.10
Post: #3
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?
Quote this message in a reply
Member
Posts: 370
Joined: 2002.04
Post: #4
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...

Did you ever wonder why we had to run for shelter when the promise of a brave new world unfurled beneath the clear blue sky?
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #5
...by typing ./myApp.
Quote this message in a reply
Member
Posts: 321
Joined: 2004.10
Post: #6
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
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Classic console development kits, samples (Atari, Nintendo, Sega, Neo Geo, etc.) smccd 14 13,764 Yesterday 05:51 PM
Last Post: smccd