title: Convert Hex to Byte in C++
body: <p>How do you convert a hex string to short in c++?</p>
  
  <p>Let's say you have </p>
  
  <pre><code>string hexByte = "7F";
  </code></pre>
  
  <p>How do you convert that to a byte? Which I assume it's a <strong>char</strong> or <strong>int8_t</strong> in c++</p>
  
  <p>I tried:</p>
  
  <pre><code>wstring hexString = "7F";
  unsigned char byte;
  stringstream convert(hexString);
  convert &gt;&gt; byte;
  </code></pre>