title: Add bits stream to buffer BYTE and write to binary file - C
body: <p>I'm trying to convert numbers to binary and then fwrite the binary numbers to binary file. 
  Assuming all numbers are 7 bits numbers (int numbers &lt; 127).
  So in the end, the file will contain the numbers as blocks of 7 bits</p>
  
  <p>I know that each BYTE is 8 bits, and i can't to write each number to 1 BYTE, but need to use the whole BYTE (i.e some of the numbers will be in 2 different BYTES)</p>
  
  <p>if : 120 = 1111000  |   7 = 0000111  | 64 = 1000000</p>
  
  <p>so the bit stream is 111100000001111000000 and should be written as </p>
  
  <pre><code>1111000|0 000111|10 00000|00
  1BYTE     2BYTE      3BYTE
  </code></pre>
  
  <p>I thought to use a buffer 
  shifting 8 bits to buffer and then fwrite to the file, using pointers 
  But i just can't mange to write it. Thank you for your help </p>