Printing out Hex?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/673240/how-do-i-print-an-unsigned-char-as-hex-in-c-using-ostream">how do I print an unsigned char as hex in c++ using ostream?</a><br>
  <a href="http://stackoverflow.com/questions/3400200/convert-ascii-string-into-decimal-and-hexadecimal-representations">Convert ASCII string into Decimal and Hexadecimal Representations</a>  </p>
</blockquote>



<p>I want to print out the hex value of characters using isprint(). However, I cannot get it to work. This is my attempt:</p>

<pre><code>getline(cin, w);
for(unsigned int c = 0; c &lt; w.size(); c++)
{
  if(!isprint(w[c]))
  {
    cout &lt;&lt; "ERROR: expected &lt;value&gt; found " &lt;&lt; hex &lt;&lt; w[c] &lt;&lt; endl;
    return 0;
  }
}
</code></pre>

<p>Can anyone help me print out this hex value? Thanks! I'm inputting things like: </p>

<p>í</p>

<p>and I want it's hex value.</p>
