• 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: ber <email@hidden>
  • Date: Fri, 30 Aug 2002 14:11:20 -0400

Thanks Chris, Ondra,

Can you freely mix select(2) and signal(2)? Of course I would make sure I don't
consume bytes from any of the run loop's file descriptors... I have preexisting code
for which I want to replace the X11 interface with Cocoa.

brian

On Friday, August 30, 2002, at 01:10 PM, Ondra Cada wrote:


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.

References: 
 >Re: Executing A Shell Script... (From: Ondra Cada <email@hidden>)

  • Prev by Date: Re: Open an URL contained in an NSString
  • Next by Date: Re: NSTextView Weirdness
  • Previous by thread: Re: Executing A Shell Script...
  • Next by thread: Re: Executing A Shell Script...
  • Index(es):
    • Date
    • Thread