title: Correct way to read a text file into a buffer in C?
body: <p>I'm dealing with small text files that i want to read into a buffer while i process them, so i've come up with the following code:</p>
  
  <pre><code>...
  char source[1000000];
  
  FILE *fp = fopen("TheFile.txt", "r");
  if(fp != NULL)
  {
      while((symbol = getc(fp)) != EOF)
      {
          strcat(source, &amp;symbol);
      }
      fclose(fp);
  }
  ...
  </code></pre>
  
  <p>Is this the correct way of putting the contents of the file into the buffer or am i abusing <code>strcat()</code>?</p>
  
  <p>I then iterate through the buffer thus:</p>
  
  <pre><code>for(int x = 0; (c = source[x]) != '\0'; x++)
  {
      //Process chars
  }
  </code></pre>