#include<sys/types.h>
#include<stdio.h>
#include<fcntl.h>
int main(){
char a[30];
int i,j;
i=open("/home/cvr/f1.txt",O_RDONLY);
j=open("/home/cvr/f2.txt",O_CREAT | O_RDWR,S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
while(read(i,&a,1)){
write(j,&a,1);
}
printf("copied succesfully");
close(i);
return 0;
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter