title: Using boost::iostreams to parse a binary file byte by byte
body: <p>So I would like to parse a binary file and extract some data from it. The problem I am facing with this is that I need to convert a stream of <code>char</code>s to a stream of <code>unsigned char</code>s.
  Reading the boost documentation, it seems that <code>boost::iostreams::code_converter</code> should be the solution for this, so I tried this:</p>
  
  <pre><code>typedef unsigned char uint8_t;
  typedef boost::iostreams::stream&lt;boost::iostreams::code_converter&lt;
     boost::iostreams::basic_array_source&lt;uint8_t&gt;, 
     std::codecvt&lt;uint8_t, char, std::mbstate_t&gt; &gt; &gt; array_stream;
  
  array_stream s; //initialized properly in the code
  unsigned char asd;
  s &gt;&gt; asd;
  std::cout &lt;&lt; asd &lt;&lt; std::endl;
  </code></pre>
  
  <p>The idea was to specify a <code>codecvt</code> with <code>InternalType=uint8_t</code> and <code>ExternalType=char</code>. Unfortunately this does not compile.
  So the question is: how do I convert a stream of <code>char</code>s to a stream of <code>uint8_t</code>s?</p>