<p>I want to read a mac id from command line and convert it to an array of <code>uint8_t</code> values to use it in a struct. I can not get it to work.  I have a vector of string for the mac id split about <code>:</code> and I want to use <code>stringstream</code> to convert them with no luck. What I am missing?</p>

<pre><code>int parseHex(const string &amp;num){
  stringstream ss(num);
  ss &lt;&lt; std::hex;
  int n;
  ss &gt;&gt; n;  
  return n;
}

uint8_t tgt_mac[6] = {0, 0, 0, 0, 0, 0};
  v = StringSplit( mac , ":" );
  for( int j = 0 ; j &lt; v.size() ; j++ ){
    tgt_mac[j] = parseHex(v.at(j)); 
  }
</code></pre>

I think you are using the std::hex in the wrong place:
```
```
#include <sstream>
#include <iostream>

int main()
{
    std::string     h("a5");
    std::stringstream   s(h);
    int x;

    s >> std::hex >> x;
    std::cout << "X(" << x << ")\n";
}
```
```