title: Convert ASCII string into Decimal and Hexadecimal Representations
body: <p>I need to convert an ASCII string like... "hello2" into it's decimal and or hexadecimal representation (a numeric form, the specific kind is irrelevant).  So, "hello" would be : 68 65 6c 6c 6f 32 in HEX.  How do I do this in C++ without just using a giant if statement?</p>
  
  <p>EDIT: Okay so this is the solution I went with:</p>
  
  <pre><code>int main()
  {
      string c = "B";
      char *cs = new char[c.size() + 1];
      std::strcpy ( cs, c.c_str() );
      cout &lt;&lt; cs &lt;&lt; endl;
  
      char a = *cs;
      int as = a;
      cout &lt;&lt; as &lt;&lt; endl;
      return 0;
  }
  </code></pre>