#include <fcntl.h>
#include <sys/stat.h>
#include <stdio.h>
#define SIZE 1
void filecopy(char *Infile,char *Outfile)
{
char Buffer[SIZE];
int In_fh,Out_fh,Count;
if((In_fh=open(Infile,O_RDONLY))==-1)
printf("Can't open the Infile!");
if((Out_fh=open(Outfile,(O_WRONLY|O_CREAT|O_TRUNC),(S_IRUSR|S_IWUSR)))==-1)
printf("Can't open the Outfile!");
while((Count=read(In_fh,Buffer,sizeof(Buffer)))>0)
{if(write(Out_fh,Buffer,Count)!=Count)
printf("Writing date");
if(Count==-1)
printf("Reading date");
}
close(In_fh);
close(Out_fh);
}
int main(int argc,char *argv[])
{
filecopy(argv[1],argv[2]);
return 0;
}
#include <sys/stat.h>
#include <stdio.h>
#define SIZE 1
void filecopy(char *Infile,char *Outfile)
{
char Buffer[SIZE];
int In_fh,Out_fh,Count;
if((In_fh=open(Infile,O_RDONLY))==-1)
printf("Can't open the Infile!");
if((Out_fh=open(Outfile,(O_WRONLY|O_CREAT|O_TRUNC),(S_IRUSR|S_IWUSR)))==-1)
printf("Can't open the Outfile!");
while((Count=read(In_fh,Buffer,sizeof(Buffer)))>0)
{if(write(Out_fh,Buffer,Count)!=Count)
printf("Writing date");
if(Count==-1)
printf("Reading date");
}
close(In_fh);
close(Out_fh);
}
int main(int argc,char *argv[])
{
filecopy(argv[1],argv[2]);
return 0;
}