|
|
Objective-C: simple way to write to stdout?
|
|
|
|
Mac Elite
Join Date: Oct 2001
Location: Internet
Status:
Offline
|
|
Hey, y'all
I have an x-code GUI project that reads telemetry from a bluetooth device. I want to be able to write this to stdout (terminal).
There's gotta be a very simple way to do this I am guessing. I'm a complete OBJ-C newb, so... well... I'm learning from this post, no?
Anyone want to learn me?
|
20+ year MacNN forum member. MacBook Air 11" 1.6Ghz 4GB 128GB Backlit Keyboard, 4S, iPad Mini
|
|
|
|
|
|
|
|
Grizzled Veteran
Join Date: Aug 2005
Location: fairbanks AK
Status:
Offline
|
|
i think your requirements for your program are a little skewed. you want a GUI app that displays output to a terminal? that kind of defeats the purpose of having a GUI, don't you think?
a NSLog() call containing the information you want would write the info to the system log which you could then read in Console.app. or, more likely what you want, you could just append/overwrite new output into a NSTextView that you place in your GUI, so the output can be seen/updated when you interact with the other controls you have for your app.
hope that helps some.
|
Earth First! we'll mine the other planets later.
|
|
|
|
|
|
|
|
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status:
Offline
|
|
You can write to stdout with printf(), just like in C. But like Black Bear Theory said, this seems kind of odd. GUI apps don't normally have a controlling terminal (hence them being GUI apps), so I don't think stdout goes anywhere.
|
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
|
|
|
|
|
|
|
|
Senior User
Join Date: Feb 2003
Location: USA
Status:
Offline
|
|
Maybe just use a multi line text field?
|
MacBook 2.0 160/2GB/SuperDrive
Lots of older Macs
|
|
|
|
|
|
|
|
Mac Elite
Join Date: Oct 2001
Location: Internet
Status:
Offline
|
|
I'm hacking existing software... It's a gui app that renders graphs of remote telemetry. I have the source code from another person. I want to be able to use the telemetry from this application in another application. If I can write the stream to stdout then I can pipe it into other shell apps, or shunt it across a network.
I know, this is an unorthodox request... just bear with me. I know that this is the functionality I need.
Looks like I will just use printf()...
Thanx for the help.
|
20+ year MacNN forum member. MacBook Air 11" 1.6Ghz 4GB 128GB Backlit Keyboard, 4S, iPad Mini
|
|
|
|
|
|
|
|
Dedicated MacNNer
Join Date: Apr 2004
Status:
Offline
|
|
yeah... just use printf and then run the app from a shell instead of by double clicking in the finder.
FWIW, NSLog() basically takes an NSString instead of a standard c string, and prepends certain info like the program name, pid, and date, and appends a \n before writing it to std out.
|
|
|
|
|
|
|
|
|
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status:
Offline
|
|
NSLog writes to stderr, actually, not stdout.
|
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
|
|
|
|
|
|
|
|
Dedicated MacNNer
Join Date: Apr 2004
Status:
Offline
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Forum Rules
|
|
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|