On Oct 30, 2008, at 16:54 , J. Todd Slack wrote:

Hi All,

Can I run an NSTask and get the results back for parsing?

I looked at CocoaDev and I see that I can specify a pipe, which needs a file to write to, but can I just get the results back in an array or something?

You would have to read the piped output yourself and put it into an array... depending on how the other app outputs it may not be that hard (like read the output directly into NSData, then to a split string that outputs your array... assuming that there is some kind of field separater generated by the other app. However...

I am running a SQL query and I wish the results to be returned to me. I am returning one field as a result of the select statement.

Why not just do the SQL query yourself? Use the database's native C library (or, even better, Objective-C bindings if it has one), or ODBC if the other database may change. I would definitely do it that way instead of using NSTask to run some command line utility and then trying to parse the output.

J

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to