title: How to store the output in a textfile automatically in C programming?
body: <p>Hei. 
  I am making a document that should be able to print out to add signature. I have the document in my output in the C program, but when saved i only get the code, not the final output. 
  This is my code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main(void)
  
  {
  
     FILE*pfile=NULL;
  
     pfile=fopen("MY_FILE","r");
  
     printf("Digital Forensics Investigation Documentation Evidence Form\n\n");
     printf("Section 1: Evidence Item Record\n");
  
     printf("---------------------------------\n");
  
  char array1[20][100]={"\nLab reference Number:","\nCase reference Number:","\nItem reference Number:","\nDevice Description:","\nAdditional Information:","\nSection 2: Investigator Details\n\nDevice accepted by:","\nDate and time received:","-------------------------------------------------------------------------","\n\nSignaure:\n","\n\n------------------"};
  
  char array2[20][500]={"TDI-DF","DFI-C001-2014-10-108","EI-201","Western Digital external hard drive,1TB","\nBlack case,with a few scratches on the side and chipped corner.\nNo obvious serial number or other distinguising features.\nPower cable and USB cable still attached.\nReceived from CTO organisation.\nIt was attached to a laptop running windows 8.\nThis laptop was powered of at the time this harddrive was removed.\n\n-------------------------------------------------------------------------","Sara Hansen","30th December 2014 at 15:00"};
  int i;
  
  for (i=0;i&lt;20;i++)
  
  {
  
   printf("%s  %s \n", array1[i], array2[i]);
  
  }
  
  fscanf(pfile,"d% d% d%");
  
  fclose(pfile);
  
      return 0;
  }
  </code></pre>
  
  <p>I want my output to be saved in the text document asell, instead of only the code.</p>
  
  <p>Can anyone please help me to find out what is missing in my code to get this saved in a text file in a proper format ?</p>
  
  <p>Thank you! </p>