• 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: NSPipe or NSFileHandle buffering?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSPipe or NSFileHandle buffering?


  • Subject: Re: NSPipe or NSFileHandle buffering?
  • From: Christian Brunschen <email@hidden>
  • Date: Sun, 1 Dec 2002 16:59:13 +0000

On Sunday, Dec 1, 2002, at 16:41 Europe/London, mw wrote:

Wow, thanks Christian! I guess that was just a bit of stupidity on my part.

It happens. Learn from it and move on :)

I just wasn't think how exact the "emulation" of a terminal is with NSTask
launching CL applications.

There is no emulation. The standard input and output streams don't 'emulate a terminal' under plain C or Perl either - they are just that, streams of bytes. If launched from a terminal, then a program's standard input and output are connected to a terminal, but there is just a special case - the general case does _not_ assume that either stream is connected to a terminal.

The code works now. However, was it really
necessary to change all of the NSString-to-NSData conversion code like that?

Not strictly _necessary_ perhaps - but the code I used is clearer and quite probably more efficient, as it doesn''t have to go through the conversion to a cString and _then_ creating an NSData from it; instead, going directly to the NSData object. Also, by going through the 'cString' method you only have the possibility of the CStringEncoding, whereas using dataUsingEncoding: you can specify the precise encoding, you know that your strings require, so that code is more flexible and reusable as well.

This is, after all, just a simple frontend for myself for testing out the
Perl script.

So? Make it a habit to always try to write good code. If you let yourself get into the habit of not caring about the quality of your code, that _will_ drag down even the code you _do_ care about. Often you will revisit your own old code you wrote once when trying to see how you solved a particular problem before, so the better that code is, the better is serves as an example for the future as well, and the better the experience you bring with you from that code.

Thanks again!

Best wishes,

mw

// Christian Brunschen
_______________________________________________
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: NSPipe or NSFileHandle buffering? (From: mw <email@hidden>)

  • Prev by Date: Basic FTP and .Mac support for a Cocoa app
  • Next by Date: Re: NSPipe or NSFileHandle buffering?
  • Previous by thread: Re: NSPipe or NSFileHandle buffering?
  • Next by thread: Re: NSPipe or NSFileHandle buffering?
  • Index(es):
    • Date
    • Thread