title: Writing binary to std::fstream using the << operator
body: <p>For some reason this sort code is not working as I would expect:</p>
  
  <pre><code>std::fstream theFile;
  theFile.open(&lt;someFilename&gt;, std::ios::beg |std::ios::out|std::ios::binary|std::ios::trunc);
  theFile &lt;&lt; 1;          //1 is being written as a string
  int var= 25;
  
  theFile &lt;&lt; 25;        //same thing, 25 is written as a string
  </code></pre>
  
  <p>What could be the problem? I am using the Microsoft C++ compiler that ships with Visual Studio 2010.</p>