title: How does fread know when the file is over in C?
body: <p>So I'm not entirely sure how to use fread. I have a binary file in little-endian that I need to convert to big-endian, and I don't know how to read the file. Here is what I have so far: </p>
  
  <pre><code>FILE *in_file=fopen(filename, "rb");
  char buffer[4];
  while(in_file!=EOF){
      fread(buffer, 4, 1, in_file);
      //convert to big-endian.
      //write to output file.
  }
  </code></pre>
  
  <p>I haven't written anything else yet, but I'm just not sure how to get fread to 'progress', so to speak. Any help would be appreciated.</p>