seekToEndOfFile
Puts the file pointer at the end of the file referenced by the receiver and returns the new file offset.
- (unsigned long long)seekToEndOfFile
Return Value
The file offset with the file pointer at the end of the file. This is therefore equal to the size of the file.
Special Considerations on [NSFileHandle seekToEndOfFile]
Raises an exception if the message is sent to an
NSFileHandle
object representing a pipe or socket or if the file descriptor is closed.
Example of [NSFileHandle seekToEndOfFile]
NSData *dataToWrite = [s dataUsingEncoding: NSUTF8StringEncoding];
NSFileHandle* outputFile = [NSFileHandle fileHandleForWritingAtPath:Log_FilePath];
[outputFile seekToEndOfFile];
[outputFile writeData:dataToWrite];