zoukankan      html  css  js  c++  java
  • 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 }
  • 相关阅读:
    第一阶段站立会议4
    第一阶段站立会议3
    用户场景描述
    第一阶段站立会议2
    第一阶段站立会议1
    第七周进度条
    第十二周工作总结
    寻找水王
    第十一周工作总结
    构建之法阅读笔记05
  • 原文地址:https://www.cnblogs.com/thbbsky/p/3720756.html
Copyright © 2011-2022 走看看