title: Reading 2 bytes from a file and converting to an int gives the wrong output
body: <p>Basically I have a text file that contains a number. I changed the number to 0 to start and then I read 2 bytes from the file (because an int is 2 bytes) and I converted it to an int. I then print the results, however it's printing out weird results. </p>
  
  <p>So when I have 0 it prints out 2608 for some reason. </p>
  
  <p>I'm going off a document that says I need to read through a file where the offset of bytes 0 to 1 represents a number. So this is why I'm reading bytes instead of characters... </p>
  
  <p>I imagine the issue is due to reading bytes instead of reading by characters, so if this is the case can you please explain why it would make a difference?</p>
  
  <p>Here is my code: </p>
  
  <pre><code>void readFile(FILE *file) {
      char buf[2];
      int numRecords;
  
      fread(buf, 1, 2, file);
  
      numRecords = buf[0] | buf[1] &lt;&lt; 8;
  
      printf("numRecords = %d\n", numRecords);
  }
  </code></pre>
  
  <p>I'm not really sure what the buf[0] | buf[1] &lt;&lt; 8 does, but I got it from another question... So I suppose that could be the issue as well. </p>