Read file in binary and output in hex std::cin to std::cout
<p>I was trying to achieve this using this code:</p>

<pre><code>char c;
while (std::cin &gt;&gt; c)
  std::cout &lt;&lt; std::hex &lt;&lt; std::setw(2) &lt;&lt; std::setfill('0') &lt;&lt; static_cast&lt;uint32_t&gt;(c);
</code></pre>

<p>but it looks like it gets messed up reading in nulls (all nulls are removed from my file).  How can I fix this?</p>
