title: Reading bytes in c++
body: <p>I'm trying to read bytes from binary file but to no success.
  I've tried many solutions, but I get no get result.
  Struct of file:</p>
  
  <pre><code>[offset] [type]          [value]          [description] 
  0000     32 bit integer  0x00000803(2051) magic number 
  0004     32 bit integer  60000            number of images 
  0008     32 bit integer  28               number of rows 
  0012     32 bit integer  28               number of columns 
  0016     unsigned byte   ??               pixel 
  0017     unsigned byte   ??               pixel 
  ........ 
  xxxx     unsigned byte   ??               pixel
  </code></pre>
  
  <p>How I tried (doesn't work):</p>
  
  <pre><code>auto myfile = fopen("t10k-images.idx3-ubyte", "r");
  char buf[30];
  auto x = fread(buf, 1, sizeof(int), myfile);
  </code></pre>