File Copy Program in C

Image result for c programming
File Copy Program in C
Code:
  #include<stdio.h>
int main(){
  FILE *fp1, *fp2;
  char fname1[50],fname2[50],ch;
  printf("Enter the input file name\n");
  scanf("%s",fname1);
  printf("Enter the output file name\n");
  scanf("%s",fname2);
  fp1=fopen(fname1,"r");
  fp2=fopen(fname2,"w");

  while((ch=getc(fp1))!=EOF)
  {
    putc(ch,fp2);
  }
  fclose(fp1);
  fclose(fp2);
 
 
    return 0;
}

No comments