title: Reading BMP file gives back unexpected data
body: <p>I made a bitmap with the following first row:
  0000000000000000000000000000000111111111 
  (It's a black line on the edge of the bitmap)
  But when I read the bitmap I get back the following data on the first row:
  1000100100001001000010010000100100001001</p>
  
  <p>Actually the first 3 rows contain the 1's and some zeros. The rest of the values are 0's.
  I use the following code:</p>
  
  <pre><code>#include "stdafx.h"
  #include &lt;iostream&gt;
  #include &lt;vector&gt;
  
  using namespace std;
  
  int main() {
      FILE* f = fopen("C:\\Users\\Laptop_Chris\\Documents\\kleinObject.bmp", "rb");
      unsigned char info[54];
      fread(info, sizeof(unsigned char), 54, f);
  
      int size = ((*(int*)&amp;info[18] * 3 + 3) &amp; (~3)) * *(int*)&amp;info[22]; //BMP - HEIGHT: *(int*)&amp;info[22]  -  WIDTH:*(int*)&amp;info[18]
  
      unsigned char* data = new unsigned char[size];
      fread(data, sizeof(unsigned char), size, f);
      fclose(f);
  
      vector&lt; vector&lt;bool&gt; &gt; myVector;
      myVector.resize(*(int*)&amp;info[22], vector&lt;bool&gt;(*(int*)&amp;info[18]));
  
      int i = 0;
  
      for (auto a = 0; a &lt; *(int*)&amp;info[22]; a++) {
          for (auto q = 0; q &lt; *(int*)&amp;info[18]; q++) {
              if ((int(data[i] &amp; 0xFF) + int(data[i + 1] &amp; 0xFF) + int(data[i + 2] &amp; 0xFF)) &gt; 0) {
                  myVector[a][q] = false;
              }
              else {
                  myVector[a][q] = true;
              }
              i = i + 3;
              cout &lt;&lt; myVector[a][q];
          }
          cout &lt;&lt; endl;
      }
      cin.get();
      return 0;
  }
  </code></pre>
  
  <p>Anybody that understands this behavior?
  Thanks in advance.</p>