• 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: Executing A Shell Script...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Executing A Shell Script...


  • Subject: Re: Executing A Shell Script...
  • From: Ondra Cada <email@hidden>
  • Date: Fri, 30 Aug 2002 19:10:57 +0200

On Friday, August 30, 2002, at 05:27 , ber wrote:

When do you use obj-c interfaces like NSTask/NSString methods

Always they are available and you have no strong reason to dodge them (like, you don't want the code to be directly compilable in any posix OS).

and when do you use plain old Unix interfaces
like popen("") and strcpy?

Only if inevitable, since Cocoa can't do that (rare enough, though of course such cases do exist), or you explicitly want not to use it (like for compatibility, see above).

Is there room for choosing when to use which or would the cocoa programming
philosophy dictate always going through the obj-c methods?

No dictate, just a common sense: Cocoa API's more flexible, more powerful,
and from programmer's view infitely more convenient.

From technical point of view though you can freely mix Cocoa and BSD (and even majority of Carbon).

I now use variable names like bufferLenth instead of buflen because I'm sure that helps me to be a better
obj-c programmer. Should I avoid using libc and section 2 of the manual when a foundation method is available?

You should, for the reasons above.

For instance, I would have told the original poster about popen(3) but I don't want to lead people down the wrong path so I generally keep my mouth shut.

NSTask's much better. Good to know popen too for cases there's a reason not to use NSTask, but they'd be pretty rare.
---
Ondra Cada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
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.
  • Follow-Ups:
    • Re: Executing A Shell Script...
      • From: ber <email@hidden>
References: 
 >Re: Executing A Shell Script... (From: ber <email@hidden>)

  • Prev by Date: Re: Tracking files the right way
  • Next by Date: Re: Executing A Shell Script...
  • Previous by thread: Re: Executing A Shell Script...
  • Next by thread: Re: Executing A Shell Script...
  • Index(es):
    • Date
    • Thread