Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<sys/stat.h>
- #include<fcntl.h>
- #include<unistd.h>
- int copy(int old, int new)
- {
- int count;
- char buffer[10];
- while((count=read(old,buffer,sizeof(buffer)))>0)
- {
- write(new,buffer,count);
- }
- close(old);
- close(new);
- }
- int main(int argc, char *argv[])
- {
- int fold,fnew;
- fold=open(argv[1],O_RDONLY);
- fnew=creat(argv[2],0777);
- copy(fold,fnew);
- return 0;
- }
Add Comment
Please, Sign In to add comment