Linux文件系统编程 系统调用 文件复制
来源:互联网 发布:苹果软件开发培训 编辑:程序博客网 时间:2024/05/21 10:33
#include <stdio.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <unistd.h>#include <string.h>#define SIZE 1024int main(){// 打开要读的文件int fd1 = open("1.ppt", O_RDONLY);if (fd1 == -1){perror ("open fd1");return -1;}int fd2 = open("2.ppt", O_WRONLY|O_CREAT, 0777);if (fd2 == -1){perror ("open fd2");return -1;}int ret = 0;char buf[SIZE] = {0};while (ret = read (fd1, buf, SIZE)){if (ret == -1){perror("read");break;}write (fd2, buf, ret);}printf ("文件复制完成\n");close (fd1);close (fd2);return 0;}
阅读全文
0 0
- Linux文件系统编程 系统调用 文件复制
- Linux文件系统编程 系统调用 文件偏移指针测试
- Linux文件系统编程 系统调用 打开读取写入文件
- linux应用编程笔记(5)系统调用文件编程方法实现文件复制
- Linux系统调用实现文件复制
- Linux系统调用实现文件复制
- LINUX文件编程-系统调用
- linux文件编程-系统调用
- Linux文件编程--系统调用
- 【Linux系统调用】文件编程
- linux系统编程 - 文件复制程序
- Linux 系统调用文件编程(文件操作)
- linux文件编程(1)系统调用
- linux历程--文件编程(系统调用)
- Linux文件编程(系统调用1)
- linux文件编程-系统调用-creat()
- Linux下系统调用文件编程整理
- linux系统调用与文件系统
- 问题 H: 生理周期
- 易混淆概念(五)模板类与类模板
- 李白打酒
- 刚体变换
- LintCode-[中等] 221. 链表求和 II
- Linux文件系统编程 系统调用 文件复制
- 顺序栈实现机制
- pscp详解
- centos 编译 PHP5.6
- 面向对象之值传递
- 【笔记】各种锅的记录之未完待续
- 样本不均衡的解决方法
- 找合法帧
- Redis