我目前正在尝试从我的文本文件中的偏移量中读取一行 5 个字符。我很确定一切正常,但是当我将缓冲区的内容打印到日志时,它会输出此<7466315c 61>
- (void)fetchCode:(id)sender{
NSData *databuffer;
NSString *path = [[NSBundle mainBundle] pathForResource:@"nCode01" ofType:@"txt"];
nCode = [NSFileHandle fileHandleForReadingAtPath:path];
if (nCode == nil) {
NSLog (@"Open of nCode for reading failed\n");
}
[nCode seekToFileOffset: 3];
databuffer = [nCode readDataOfLength: 5];
NSLog (@"Data = %@", databuffer);
[nCode closeFile];
}
我认为这可能是格式错误,而不是内存,因为每次我运行它打印相同的方法<7466315c 61>知道我错过了什么/做错了什么吗?