Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <unistd.h>
- #include <fcntl.h>
- int f1,f2,i=-1;
- char *c;
- int main(int argc,char *argv[])
- {
- f1=open(argv[1],O_RDONLY);
- f2=open(argv[2],O_WRONLY);
- printf("%d %d\n",f1,f2);
- if (f1>=0)
- {
- lseek(f1,i,2);
- while (read(f1,&c,1))
- {
- write(f2,&c,1);
- --i;
- if (lseek(f1,i,2)==-1)
- break;
- }
- }
- close(f1);
- close(f2);
- ulink(argv[1]);
- link(argv[2],argv[1]);
- ulink(argv[2]);
- printf("OK\n");
- return 0;
- }
Add Comment
Please, Sign In to add comment