Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> #define MAX_SIZE 2048 int main(int argc, char * argv[]) { int in_fd; int out_fd; int chars; char buf[MAX_SIZE] = {0}; if(argc != 3) //入口参数检查 { printf("please input a!\n"); exit(1); } in_fd = open(argv[1],O_RDONLY); if(in_fd == -1) { printf("open file error!\n"); exit(1); } out_fd = creat(argv[2],0644); if(out_fd == -1) { printf("create file error!\n"); exit(1); } chars = read(in_fd,buf,MAX_SIZE); if(chars == -1) { printf("read file error!\n"); exit(1);    } if(write(out_fd,buf,chars) != chars) { printf("write file error!\n"); exit(1); } close(in_fd); close(out_fd);   return 0; }

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors