#cat copy.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h> int copyFile(char *fileRead,char *fileWrite); int main(){
char fileRead[100];
char fileWrite[100]; printf("要复制的文件:");
scanf("%s",fileRead);
printf("目标文件:");
scanf("%s",fileWrite); if(copyFile(fileRead,fileWrite)){
printf("拷贝成功");
}else{
printf("复制失败");
} return 0;
} int copyFile(char *fileRead,char *fileWrite){
FILE *fpRead;
FILE *fpWrite;
int bufferLen=1024*4;
char *buffer = (char*)malloc(bufferLen);
int readCount; if((fpRead=fopen(fileRead,"rb")) == NULL || (fpWrite=fopen(fileWrite,"wb")) == NULL){
printf("can not open file");
exit(1);
} while((readCount=fread(buffer,1,bufferLen,fpRead)) > 0){
fwrite(buffer,readCount,1,fpWrite);
} free(buffer);
fclose(fpRead);
fclose(fpWrite);
return 1; }

copy.c实现的更多相关文章

  1. HEC-ResSim原文档

              HEC-ResSim Reservoir System Simulation             User's Manual       Version 3.1 May 201 ...

  2. 关于ubuntu实机与虚机互相copy

    我的开发环境是在ubuntu上的,但是ubuntu上没有官方支持的QQ,有些不太方便,所以在上面虚了一个Win7(先是win10,但是win10最新版本太坑了,不说了),不过经常会出现复制文件,或者文 ...

  3. 探究@property申明对象属性时copy与strong的区别

    一.问题来源 一直没有搞清楚NSString.NSArray.NSDictionary--属性描述关键字copy和strong的区别,看别人的项目中属性定义有的用copy,有的用strong.自己在开 ...

  4. copy()之绝版应用

    我选用了一个稍稍复杂一点的例子,它的大致功能是:从标准输入设备(一般是键盘)读入一些整型数据,然后对它们进行排序,最终将结果输出到标准输出设备(一般是显示器屏幕).这是一种典型的处理方式,程序本身具备 ...

  5. Marshal.Copy将指针拷贝给数组

    lpStatuss是一个UNITSTATUS*的指针类型实例,并包含SensorDust字段 //定义一个数组类型 byte[] SensorDust = new byte[30] //将指针类型拷贝 ...

  6. @property中的copy.strong.weak总结

    1.NSString类型的属性为什么用copy NSString类型的属性可以用strong修饰,但会造成一些问题,请看下面代码 #import "ViewController.h" ...

  7. block为什么用copy以及如何解决循环引用

    在完成项目期间,不可避免的会使用到block,因为block有着比delegate和notification可读性更高,而且看起来代码也会很简洁.于是在目前的项目中大量的使用block. 之前给大家介 ...

  8. [LeetCode] Copy List with Random Pointer 拷贝带有随机指针的链表

    A linked list is given such that each node contains an additional random pointer which could point t ...

  9. NSString属性什么时候用copy,什么时候用strong?

           我们在声明一个NSString属性时,对于其内存相关特性,通常有两种选择(基于ARC环境):strong与copy.那这两者有什么区别呢?什么时候该用strong,什么时候该用copy呢 ...

  10. iOS 浅谈:深.浅拷贝与copy.strong

    深.浅拷贝 copy mutableCopy NSString NSString *string = @"汉斯哈哈哈"; // 没有产生新对象 NSString *copyStri ...

随机推荐

  1. linux程序设计——运行SQL语句(第八章)

    8.3    使用C语言訪问MySQL数据 8.3.3 运行SQL语句 运行SQL语句的主要API函数被恰当的命名为: int mysql_query(MYSQL *connection, const ...

  2. 查看及更改MySQL数据库物理文件存放的位置

    查看命令:   mysql> show global variables like "%datadir%"; 表格第二行即为文件的位置.另外,可以在该文件夹的配置文件my.i ...

  3. C# DateTime.Now和DateTime.UtcNow的区别

    DateTime.UtcNow.ToString()输出的是0时区的事件(通俗点就是格林威治时间的当前时间),DateTime.Now.ToString()输出的是当前时区的时间,我们中国使用的是东八 ...

  4. ffplay.c函数结构简单分析(绘图)

    近期重温了一下FFplay的源码. FFplay是FFmpeg项目提供的播放器演示样例.虽然FFplay不过一个简单的播放器演示样例,它的源码的量也是不少的. 之前看代码,主要是集中于某一个" ...

  5. Uva 11151 - Longest Palindrome

    A palindrome is a string that reads the same from the left as it does from the right. For example, I ...

  6. SuperSocket中的Server是如何初Start的

    第一个函数 d:\sourcecode\github\supersocket\quickstart\basic\telnetserver_startbyconfig\program.cs static ...

  7. 03、HelleBaiduMap

    D:\百度地图\百度地图\资料\百度地图与定位SDK\百度地图v3.5.0\BaiduMap_AndroidSDK_v3.5.0_All\BaiduMap_AndroidSDK_v3.5.0_Docs ...

  8. Mybatis 代码自动生成(generatorConfig.xml配置)

    博客推荐: Mybatis最入门---代码自动生成(generatorConfig.xml配置) MyBatis Generator generatorConfig.xml配置详解 pom.xml&l ...

  9. input如何去掉边框

    outline: none; border:solid 0px; 两个属性,ok.

  10. vue tab 点击请求方法

    页面: <Tabs value="name1" style="width: 100%;height: 900px;" @on-click="ge ...