title: Reading bits from file
body: <p>I can read for example , 4 bytes from file using </p>
  
  <pre><code>ifstream r(filename , ios::binary | ios::in)
  uint_32 readHere;
  r.read( (char*)&amp;readHere, 4 )
  </code></pre>
  
  <p>But how could i read 4.5 bytes = 4bytes and 4 bits. </p>
  
  <p>What came to my mind is </p>
  
  <pre><code>ifstream r(filename , ios::binary | std::in)
  uint_64t readHere;
  r.read( (char*)&amp;readHere, 5 ) // reading 5 bytes ;
  
  uint_64t tmp = readHere &amp; 11111111 // extract 5th bytes
  tmp = tmp &gt;&gt; 4  // get first half of the bites
  readHere = (( readHere &gt;&gt; 8 ) &lt;&lt; 8) | tmp     // remove 5th byte then add 4 bits
  </code></pre>
  
  <p>But im not sure how shouldi take half of byte , if first or last 4.
  Is there some better way how to retrieve it?</p>