You are on page 1of 1

#include <sys/types.

h>
#include <sys/stat.h>
#include <fcntl.h>
#include<unistd.h>
#include<stdio.h>
main(int argc,char*argv[])
{
int k,size,c,c1;
char buf;
k=open(argv[1],O_RDONLY);
size=read(k,&buf,1);
creat(argv[2],S_IRWXU);
c1=open(argv[2],O_RDWR);
while(size!=0)
{
write(c1,&buf,1);
size=read(k,&buf,1);
}
close(k);
close(c1);
}

You might also like