title: C, fread binary from bin file
body: <p>I'm pretty new to C, but I have come across a problem with fread...</p>
  
  <p>My end goal is to read (and then printf to console) the binary from a .bin file, but for now i'm taking it one step at a time and trying to just read the first bit...</p>
  
  <p>My code:</p>
  
  <pre><code>...
  FILE *file = fopen("test1.bin", rb);
  int i = 0;
  fread(&amp;i, 1, 1, file);
  printf("%i\n", i);
  ...
  </code></pre>
  
  <p>Now i've tried this on three different .bin files, one outputted 0, other 2 and the other 12!</p>
  
  <p>Why is it outputting 2/12 when I am reading in just one 1 bit from file? Shouldn't it be a 0 or a 1? what am I doing wrong? Thanks alot.</p>