 <p>This is the very simple method that I am using to convert two individual doubles with a max of 255 to hex (firstNumber and secondNumber):</p> <pre><code>std::string hexCodes = "0123456789abcdef"; std::stringstream finalResult; finalResult &lt;&lt; hexCodes.at(floor(firstNumber/ 16)) &lt;&lt; hexCodes.at(firstNumber- (16 * (floor(firstNumber/ 16)))); finalResult &lt;&lt; hexCodes.at(floor(secondNumber/ 16)) &lt;&lt; hexCodes.at(secondNumber- (16 * (floor(secondNumber/ 16)))); std::string finalString = finalResult.str(); </code></pre> <p>I am not very good at writing code and after trawling google for a result to this problem I didn't find any solutions, so wrote this and it works...so far </p>