title: Reading text file into char array
body: <p>I'm having some trouble getting text into a char array. It worked fine when I set a static size for the array like</p>
  
  <pre><code>char speech[15000];
  </code></pre>
  
  <p>but that was inefficient so I tried using calloc instead. That made it stop working. The array exists at the right size, but nothing gets written in. Here's the relevant code. What am I doing wrong?</p>
  
  <pre><code>int main() {
  
  FILE* inFile;
  int i;
  int count = 0;
  
  printf("\nOpening file April_30_1789.txt\n");
  
  inFile = fopen("./speeches/April_30_1789.txt", "r");
  
  if(inFile == NULL) {
      printf("Could not find April_30_1789.txt\n");
      return -1;
  }
  
  char ch;
  
  while((ch = fgetc(inFile) != EOF)) count++;
  
  rewind(inFile);
  
  int size = count;
  
  printf("Size of the array is %d\n", size);
  
  char *speech = (char *)malloc(size*sizeof(char) + 1*sizeof(char));
  
  fscanf(inFile, "%s", speech);
  
  printf("Closing the file.\n");
  fclose(inFile);
  
  printf("%s", speech);
  
  printf("\n\nDone\n");
  
  return 0;
  
  }
  </code></pre>
  
  <p>Currently, this gives me</p>
  
  <pre><code>Opening file April_30_1789.txt
  Size of the array is 8617
  Closing the file.
  Fellow-Citizens
  
  Done
  </code></pre>