title: How to return a hex value after converting it from a string
body: <p>I am trying to return a hex value inside this method. not sure where I'm going wrong. not sure how put the value into hex without using cout. have not been able to find a solution. Input value is always going to be 32 bits long</p>
  
  <p>its like i want to return <code>hex &lt;&lt; x</code> but thats not an option.</p>
  
  <pre><code>string StringToHex (myInstruction* RealList, int Pos)
  {
      string result = "11111111110000000000110011001100";
      unsigned long x = strtoul(result.c_str(), &amp;pEnd, 2);
      cout&lt;&lt; hex &lt;&lt; x&lt;&lt;endl;
      return  x;
  }
  </code></pre>