////main.m//Nsfilehandler////Created by MAC on 15/12/26.//copyright©2015 year MAC. All rights reserved.//#import<Foundation/Foundation.h>intMainintargcConst Char*argv[]) {@autoreleasepool {//Nsfilehandler can read the picture interface pipeline//ReadNSString *path =@"/tmp/test100000.txt"; Nsfilehandle*readinghandle =[Nsfilehandle Filehandleforreadingatpath:path]; NSData*data =[Readinghandle Readdatatoendoffile]; NSString*str =[[NSString Alloc]initwithdata:data encoding:nsutf8stringencoding]; NSLog (@"%@", str); //WriteNSString *path1 =@"/tmp/test100000.txt"; Nsfilehandle*writinghandle =[Nsfilehandle filehandleforwritingatpath:path1]; NSString*string=@"Hahahahahahhaa"; Data= [stringdatausingencoding:nsutf8stringencoding]; [Writinghandle Writedata:data]; //UpdateNSString *path2 =@"/tmp/test2.txt"; Nsfilehandle*updatinghandle =[Nsfilehandle filehandleforupdatingatpath:path2]; } return 0;}
Nsfilehandle can read and write to other pictures