cp.c

PHOTO EMBED

Fri May 10 2024 02:28:57 GMT+0000 (Coordinated Universal Time)

Saved by @exam123

#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;
		}

		
content_copyCOPY