O'Reilly logo

Advanced Mac OS X Programming: The Big Nerd Ranch Guide by Mark Dalrymple

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

NSFileHandle

When reading a file, Cocoa programmers often read in an entire file and pack it into an NSData or NSString before parsing it. When writing a file, Cocoa programmers usually create a complete NSData or NSString which is then written to the file system. Sometimes you want more control over reading from and writing to files. For example, you might read a file just until you find what you want and then close it. For more control over reading and writing from files, you use an NSFileHandle object.

An NSFileHandle is used for reading and writing files. Some of the reading methods are blocking (that is, the application stops and waits for the data to become available), and others are non-blocking. We’ll discuss the non-blocking methods ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required