title: C++ ofstream float encode
body: <p>does anyone knows how to write an IEEE 754 single-precision (32-bit) floating-point number to an ofstream?</p>
  
  <p>i'm using:</p>
  
  <pre><code>float VERSION = 0.1;
  ofstream header;
  header.open("a4.pbf",ios::binary);
  header.write(reinterpret_cast&lt;const char*&gt;(&amp;VERSION), sizeof(float));
  header.close();
  </code></pre>
  
  <ul>
  <li>the result value:   "0xCD,0xCC,0xCC,0x3D" </li>
  <li>the value expected: "0x3D,0xCC,0xCC,0xCD"</li>
  </ul>
  
  <p>thanks.</p>