title: C number of characters on file
body: <p>Why is my program returning me 9 when the file has "test1" written?
  The program looks for number of characters within the file. I wanted to run off the 'while(fgetc(file) != EOF)' method but this seems not to be working.</p>
  
  <p>I would appreciate some help on this. Thank you</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  #define FORMATLOG "FORMAT ERROR: invalid parameter: s5e4 &lt;filename.txt&gt;"
  #define TXFILELOG "FILE ERROR: Can't open file or file does not exist"
  
  enum { true, false };
  
  
  int interface(char *filename) {
  
      FILE *f_text = fopen(filename, "r+");
      size_t size;
      char c;
  
      if(f_text == NULL) {
          puts(TXFILELOG);
          return NULL;
      }
  
      fseek(f_text, 0, SEEK_END);
      size_t length = (size_t) ftell(f_text);
  
      printf("%d", length);
  
      fclose(f_text);
  
      return true;
  }
  
  
  int main(int argc, char **argv) {
  
      if(argc != 2) {
          puts(FORMATLOG);
          return false;
      }
  
      return interface(argv[1]);
  }
  </code></pre>