Header Ads

Hii,I am Anand Nayak.This blogger is make for specially basic programs of some language.

Copy Of Exits File

// print a copy file of exits file
#include<stdio.h>
#include<conio.h>
 void main()
    {
      int i;
       FILE *fp,*ftpr, *ftp;
       char str[100];
       char *filename="bhaii.csv";  //file should saved where located program
       clrscr();
       fp=fopen(filename,"r");
if(fp==NULL)
{
   printf("could not open this file");
   exit(0);
}
ftpr=fopen("outdor.csv","w");
  if(ftpr==NULL)
   {
     printf("could not open this file");
     exit(0);
   }
while(fgets(str,100,fp)!=NULL)
   {
     fputs(str,ftpr);
   }
     fclose(fp);
     fclose(ftpr);
      getch();
   }

No comments