#include<stdio.h>
#include<conio.h>
void
main(int argc,char *argv[])
{
FILE *fs,*ft;
char ch,ans;
int i;
clrscr();
if(argc!=3)
{
printf("\n Not enough paramenter
");
getch();
exit(0);
}
// open
source file in read mode
fs=fopen(argv[1],"r");
if(fs==NULL)
{
printf("\n source file not found :
%s",argv[1]);
getch();
exit(0);
}
// check
whether the file names are same or not
if(strcmp(argv[1],argv[2])==0)
{
printf("\n Can not copy to itself
");
getch();
exit(0);
}
// open
target file in write mode
ft=fopen(argv[2],"w");
while((ch=fgetc(fs))!=EOF)
{
fputc(ch,ft);
}
printf("\n 1 file cpoied ");
getch();
}