title: Microsoft Visual Studio C Runtime Library has detected a fatal error in filecopy.exe
body: <p>It's the simpliest program but I've got this error. I copy all information from one file to another. (Frankly I need to copy information from several files)</p>
  
  <pre><code> #include &lt;stdio.h&gt;
   #include &lt;string.h&gt;
  
   void CopyTo(FILE *x)
   {
      FILE *f0;
      char *s=new char[100];
      f0=fopen("file0.txt","wt+");
      while(fgets(s,sizeof(s),x))
      {
          fwrite(s,1,strlen(s)+1,x);
      }
      fclose(f0);    
   };
  
   int main()
   {
      FILE *fi;
      fi=fopen("file1.txt","rt");
      CopyTo(fi);
      fclose(fi);
      printf("finish");
      getchar();
   }
  </code></pre>