oc语言复制视频文件

 1 void copyFile()
 2 {
 3     NSString *home=NSHomeDirectory();
 4     NSString *path=[NSString stringWithFormat:@"%@/desktop/oc.mp4",home];
 5     NSString *path1=[NSString stringWithFormat:@"%@/desktop/oc1.mp4",home];
 6     NSFileHandle *handle=[NSFileHandle fileHandleForReadingAtPath:path];
 7     NSFileManager *fm=[NSFileManager defaultManager];
 8     BOOL ret=NO;
 9     if ([fm fileExistsAtPath:path1])
10     {
11         NSLog(@"存在");
12     }
13     else
14     {
15        ret= [fm createFileAtPath:path1 contents:nil attributes:nil];
16     
17     }
18     NSFileHandle *writeHandle=[NSFileHandle fileHandleForWritingAtPath:path1];
19     NSData *data=nil;
20     if (ret==YES)
21     {
22         data=[handle readDataOfLength:1024*1024];
23         while ([data length]==1024*1024)
24         {
25             [writeHandle writeData:data];
26             data=[handle readDataOfLength:1024*1024];
27         }
28         [writeHandle writeData:data];
29     }
30     [handle closeFile];
31     [writeHandle closeFile];
32 
33 }

 

oc语言复制视频文件,古老的榕树,5-wow.com

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。