문제

I am just wanting to know how offsetInFile works? and what is the difference between seekToFileOffSet. and code examples you know of would be helpfull as well :)

도움이 되었습니까?

해결책

For standard file descriptors, -[NSFileHandle offsetInFile] and -seekToFileOffset: have straightforward POSIX equivalents:

[handle offsetInFile];
    => off_t offset = lseek([handle fileDescriptor], 0, SEEK_CUR);

[handle seekToFileOffset:off];
    => off_t offset = lseek([handle fileDescriptor], off, SEEK_SET);

The difference between them is that the first returns the current offset, while the second changes the offset.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top