title: how to stop reading from file in C
body: <p>I am just trying to read each character of the file and print it out but when the file finishes reading, but I am getting a bunch of ? after it finishes reading. How do I fix it?</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main(void){
      FILE *fr;            /* declare the file pointer */
  
      fr = fopen ("some.txt", "r");  /* open the file for reading */
          /* elapsed.dta is the name of the file */
          /* "rt" means open the file for reading text */
      char c;
      while((c = getc(fr)) != NULL)
      {
          printf("%c", c);
      }
      fclose(fr);  /* close the file prior to exiting the routine */
      /*of main*/ 
  
  
      return 0;
  }
  </code></pre>