//NSFileHandle 主要负责对文件内容进行读取和写入操作 注意此对象不能创建文件
NSString *home = [NSHomeDirectory() stringByAppendingString:@"/Documents/10.txt"];
/*
//读取写入数据
NSFileHandle *handle = [NSFileHandle fileHandleForWritingAtPath:home];
//设置到文件末尾 类似于追加数据
[handle seekToEndOfFile];
//写入数据
[handle writeData:[@"sucessfuly!" dataUsingEncoding:NSUTF8StringEncoding]];
*/
NSFileHandle *handle = [NSFileHandle fileHandleForReadingAtPath:home];
//从当前的偏移量移动到文件结尾
[handle seekToEndOfFile];
//设置指定偏移量
[handle seekToFileOffset:1];
//获取当前偏移量
[handle offsetInFile];
//从当前偏移量读取到结尾
[handle readDataToEndOfFile];
//从指定偏移量开始读取指定长度数据
[handle readDataOfLength:100];
//读取数据
NSLog(@"%@",[[NSString alloc] initWithData:[handle availableData] encoding:NSUTF8StringEncoding]);
//关闭文件流
[handle closeFile];