ios - pasting content to a file - NSFileManager -
i want add contents file2(file2 contains content , should not replaced) file1. copyitematpath throws error file2 exists.is there way add contents file instead of replacing existing contents.
if(![[nsfilemanager defaultmanager] fileexistsatpath:logpath2]) [[nsfilemanager defaultmanager] createfileatpath:logpath2 contents:[nsdata data] attributes:nil]; if ([filemgr copyitematpath: logpath1 topath: logpath2 error: &err]) nslog (@"temp move successful"); else nslog (@"temp move failed %@",err);
this not possible nsfilemanager
, can use -[nsoutputstream outputstreamtofileatpath:append:]
(documentation) achieve this.
Comments
Post a Comment