title: Why am I getting negative one bytes for my output?
body: <p>I tried to develop a simple metadata visualizer tool using C for visualizer engine for &quot;png&quot; file but I'm getting -1 for my output and I don't know why. Can someone show me where is the error?</p>
  <p>#include &lt;stdio.h&gt;</p>
  <pre><code>int main ()
  {
      FILE *file_input;
      unsigned char c; //unsigned
      long int counter=0L;
      long int saizFail, curPos=0L, current=0L;
      
      if ((file_input = fopen(&quot;C:\\Users\\User\\Pictures\\timetable.png&quot;, &quot;rb&quot;))=NULL)
           printf(&quot;File cannot be opened&quot;);
                   
      fseek(file_input, 0L, SEEK_END); //
      saizFail=ftell(file_input);
      rewind(file_input);
      
      printf(&quot;File size = %ld bytes\n\n&quot;, saizFail);
      
      while (counter&lt;100)
      {
          c=fgetc(file_input);
          printf(&quot;counter %ld &gt;&gt; %X\n&quot;, counter, c);
          counter++;
          
      }
      
      printf(&quot;&gt;&gt;File size = %ld bytes\n\n&quot;, saizFail);
      
      fclose(file_input);
      getchar();
  }
  </code></pre>