Linux 上标准c复制文件
2017-12-19 20:30
225 查看
#include "stdafx.h" #include<stdio.h> #include<stdlib.h> int _tmain(int argc, _TCHAR* argv[]) { char *path = "C:\\Users\\Administrator\\Desktop\\original.PNG"; char *newpath = "C:\\Users\\Administrator\\Desktop\\copy.PNG"; //标准c复制文件 FILE *file = fopen(path, "rb"); FILE *copy = fopen(newpath,"wb"); if (file == NULL){ printf("%s\n","文件打开失败!。。。"); return -1; } if (copy==NULL) { printf("%s\n", "文件打开失败"); return -1; } int buffer[50] = {0}; int temp = 0; while ((temp=fread(buffer, sizeof(int), 50, file))>0) { printf("读取个数:%d\n",temp); fwrite(buffer, sizeof(int), temp, copy); } printf("读取完成"); int clsoe1=fclose(file); int close2=fclose(copy); printf("关闭结果:%d和%d\n", clsoe1, close2); return 0; }
相关文章推荐
- Linux基础 文件系统目录标准FHS
- 将Linux 标准输出,错误输出重定向到文件
- linux 文件内容的复制
- Linux入门学习,怎么创建文件?怎么复制、剪切、删除文件?——(三)
- linux 文件IO和标准IO的一些实现细节
- linux shell特性 history FHS规范(linux文件目录标准)
- Linux 标准输出到文件
- linux学习入门3——linux文件基本操作(linuxcast.net)(复制、移动、重命名、创建、删除文件及文件夹)
- RHCE7 管理I-12归档文件并在Linux系统间复制文件
- Linux练习(函数调用复制文件)
- Linux 中复制文件到多个目录中
- linux下c语言实现多线程文件复制
- 【转】linux cp 复制文件 命令
- linux文件设备与I/O:C标准I/O函数与无缓冲I/O
- 用Linux命令行实现删除和复制指定类型的文件
- linux命令之文件的复制(CP)
- linux 从一台机器复制文件到另一台linux机器上去
- Linux scp复制文件,不需要输入密码的技巧
- (九)linux下文件io与c的标准io对比
- linux中通过shell脚本复制文件,并用时间戳命名