Re: Integrating a C command line tool into Objective-C application
Re: Integrating a C command line tool into Objective-C application
- Subject: Re: Integrating a C command line tool into Objective-C application
- From: PGM <email@hidden>
- Date: Sun, 9 Sep 2007 09:49:02 -0400
Hello everyone,
Now my question. I've read through the documentation and also done
google searches but I am yet to find *exactly* what I'm looking for
to help me. A colleague wrote a command line tool in C a while back
and now I want to integrate that tool into my obj-c code. I'm not
sure how to go about this. I started coding on obj-c about a year
ago on and off and haven't coded in C before, but looking through
some books I have a general idea in that area. The problem is the
integration, ie the Main function etc. Do I make the C code a new
class and strip out the main function? I tried using that code
verbatim (minus Main) and tried to turn it all into a method but
the compiler said I can't have nested functions. If anybody can
help in this area, I would be most appreciative.
If the commandline tool is not too complex is its interaction with
the user (e.g. it simply takes some arguments and produces output on
stdout), you can also include it in your bundle by dragging the
executable to the resources group in the XCode sidebar. Then you can
use NSTask to run it and NSPipe and NSFileHandle to input and output
data.
For a tutorial, see: http://cocoadevcentral.com/articles/000025.php
Cheers, Patrick
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden