首页 > 编程语言 > 详细

oc语言复制视频文件

时间:2014-05-10 22:12:55      阅读:434      评论:0      收藏:0      [点我收藏+]
bubuko.com,布布扣
 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 }
bubuko.com,布布扣

 

oc语言复制视频文件,布布扣,bubuko.com

oc语言复制视频文件

原文:http://www.cnblogs.com/thbbsky/p/3720756.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!