Re: command line tool output into a string?
Re: command line tool output into a string?
- Subject: Re: command line tool output into a string?
- From: Bob Ippolito <email@hidden>
- Date: Sat, 24 Apr 2004 07:08:13 -0400
On Apr 24, 2004, at 6:13 AM, Ben Dougall wrote:
On Saturday, April 24, 2004, at 01:20 am, Bob Ippolito wrote:
On Apr 23, 2004, at 7:56 PM, email@hidden wrote:
i'm using a system() call to call a command line tool. the command
line tool's output is output to standard output. is there anyway to
get that output directly into a string rather than having to direct
it into a file, then open that file? if so, how?
Yeah, don't use system(). You should use a high level abstraction
like NSTask, or you need to use popen or the like.
thanks for the reply.
even with NSTask, are you sure you can get the output directly into a
string? there's:
- (void)setStandardOutput:(id)file
which takes a file as an argument -- it's that that i'd like to avoid
if possible, and have the output go straight into a string bypassing
the file bit somehow.
Not "directly", but you use a NSPipe and you can more or less get that
as a NSData which can be converted to a string.
-bob
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.