iOS의 파일에서 마지막 줄을 제거하려면 어떻게해야합니까?파일의 마지막 줄 삭제하기 iPhone iOS
다음은 파일 끝으로 이동하지만 그 마지막 줄을 제거하는 방법을 모르는 코드입니다.
NSArray *paths = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
//make a file name to write the data to using the documents directory:
NSString *file = [NSString stringWithFormat:@"%@/%@.daa", documentsDirectory, MFILE_NAME];
NSFileHandle *aFileHandle = [NSFileHandle fileHandleForWritingAtPath:file];
//setting aFileHandle to write at the end of the file
[aFileHandle truncateFileAtOffset:[aFileHandle seekToEndOfFile]];
도움 주셔서 감사합니다. 이 글을 읽고 몇 가지 문서는 내가 함께 결국 무엇 후