The methods provided by
NSFileHandle enable you to work more closely with files. At the beginning of this chapter, we listed some of the things you can do with these methods.
In general, follow these three steps when working with a file:
1. Open the file and obtain an
NSFileHandle object to reference the file in subsequent I/O operations.
2. Perform your I/O operations on the open file.
3. Close the file.
Table 16.7 summarizes some commonly used
NSFileHandle methods. In this table fh is an
NSFileHandle object, data is an
NSData object, path is an
NSString object, and offset is an
unsigned long long.