title: Writing bits to a file in C
body: <p>I have this string: "101"
  I want to write it to a file, in C, not as text: "101" and so 8 bits x char. but directly use the string as bits: the bit "1", the bit "0" and the bit "1", so that the file will be of 3 bits.</p>
  
  <p>Is it possibile?
  I searched on the web and I tried doing this:</p>
  
  <pre><code>char c[25] = "101";
  FILE *binFile = fopen("binFile.bin", "wb");
  int x = atoi(c);
  fwrite(&amp;x, sizeof(x), 1, binFile);
  </code></pre>
  
  <p>But at the end, when I verify files's bytes, Windows says me that it is 4bytes file! And not 3bits!</p>
  
  <p>How can I do this, if it is possible? Thanks a lot.</p>