Combine 2 hexadecimal characters from file and convert to decimal <p>I am trying to combine two hexadecimal characters from a file into one hexadecimal and then convert to decimal/integers. I read the whole line from the file as a string and parse it into its individual chars (as each hexadecimal represents a separate entity), but one entity is two hexadecimal characters and I am trying to figure out to combine them. So in the file at elements 4 and 5 I have hexadecimal values of 0x1F and 0x01 and I am trying to combine them to make 0x011F (reserved direction). Here is a sample of the code(working in C++):</p> <pre><code>std::string fileline; unsigned char tempchar; tempchar = fileline.at(3); //Sample of parsing individual chars std::cout &lt;&lt; (int)tempchar &lt;&lt;std::endl; //Displaying the correct value //This is where I am having problems unsigned char newchar[2]; //From the file, fileline.at(5) = 0x01 and fileline.at(4) = 0x1F //Trying to get the value of 287 from these two elements newchar[0] = fileline.at(5); newchar[1] = fileline.at(4); //This is where it goes wrong and I dont know how to combine the two separate elements </code></pre>