title: Writing NULL char to file in C
body: <p>I am attempting to write an array of char to a BMP file in C. The problem with this is that whilst 0x00 values are required for the file, it seems C interprets this as the end of string when writing to the file i.e. as a NULL char. Is there any way I can override this and have C rely purely on what I say is the number of char I wish to pass?</p>
  
  <p>Code for writing the header to file (this function is executed in main);</p>
  
  <pre><code>void writeFile(void){
      unsigned char bmp1[54] = {
      0x42, 0x4D, 0x36, 0x00, 
      0x0C, 0x00, 0x00, 0x00, 
      0x00, 0x00, 0x36, 0x00, 
      0x00, 0x00, 0x28, 0x00, 
      0x00, 0x00, 0x00, 0x02, 
      0x00, 0x00, 0x00, 0x02, 
      0x00, 0x00, 0x01, 0x00, 
      0x18, 0x00, 0x00, 0x00, 
      0x00, 0x00, 0x00, 0x00, 
      0x0C, 0x00, 0x00, 0x00, 
      0x00, 0x00, 0x00, 0x00, 
      0x00, 0x00, 0x00, 0x00, 
      0x00, 0x00, 0x00, 0x00, 
      0x00, 0x00
      };
  
      FILE *picFile = fopen("pic.bmp","w");
      fprintf(picFile, bmp1, 54);
      fclose(picFile);
  }
  </code></pre>