title: How to convert a char array to a list of HEX values?
body: <p>Would I would like to be able to do is convert a char array (may be binary data) to a list of HEX values of the form: ab 0d 12 f4 etc....</p>
  
  <p>I tried doing this with </p>
  
  <p>lHexStream &lt;&lt; "&lt;" &lt;&lt; std::hex &lt;&lt; std::setw (2) &lt;&lt; character &lt;&lt; ">";</p>
  
  <p>but this did not work since I would get the data printing out as:</p>
  
  <pre><code>&lt;ffe1&gt;&lt;2f&gt;&lt;ffb5&gt;&lt;54&gt;&lt; 6&gt;&lt;1b&gt;&lt;27&gt;&lt;46&gt;&lt;ffd9&gt;&lt;75&gt;&lt;34&gt;&lt;1b&gt;&lt;ffaa&gt;&lt;ffa2&gt;&lt;2f&gt;&lt;ff90&gt;&lt;23&gt;&lt;72&gt;&lt;61&gt;&lt;ff93&gt;&lt;ffd9&gt;&lt;60&gt;&lt;2d&gt;&lt;22&gt;&lt;57&gt;
  </code></pre>
  
  <p>Note here that some of the values would have 4 HEX values in them? e.g. </p>
  
  <p>What I would be looking for is what they have in wireshark, where they represent a char aray (or binary data) in a HEX format like:</p>
  
  <p>08 0a 12 0f</p>
  
  <p>where each character value is represented by just 2 HEX characters of the form shown above. </p>