Created
February 29, 2012 07:52
-
-
Save nickyp/1938968 to your computer and use it in GitHub Desktop.
NSFileHandle seekToEndOfFile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSFileHandle *aFileHandle; | |
NSString *aFile; | |
aFile = [NSString stringWithString:@"Your File Path"]; //setting the file to write to | |
aFile = [logFile stringByExpandingTildeInPath]; | |
aFileHandle = [NSFileHandle fileHandleForWritingAtPath:aFile]; //telling aFilehandle what file write to | |
[aFileHandle truncateFileAtOffset:[aFileHandle seekToEndOfFile]]; //setting aFileHandle to write at the end of the file | |
[aFileHandle writeData:[toBeWritten dataUsingEncoding:nil]]; //actually write the data | |
For more Information see Documentation---Foundation---NSFileHandle |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment