• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Integrating a C command line tool into Objective-C application
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Integrating a C command line tool into Objective-C application (From: Jason Wiggins <email@hidden>)

  • Prev by Date: Cocoa with CodeWarrior?
  • Next by Date: Re: Getting button binding to invoke an action
  • Previous by thread: Re: Integrating a C command line tool into Objective-C application
  • Next by thread: [NSKeyedUnarchiver decodeObjectForKey:] bug during call to [NSDocumentController openUntitledDocumentAndDisplay: error:]
  • Index(es):
    • Date
    • Thread