I have some code for converting an int to a string
char val = 0x79;
std::stringstream str1, str2;
str1 << std::hex << val;
str2 << std::hex << (short) val;
std::cout << str1.str() << std::endl;
std::cout << str2.str() << std::endl;
The output is
y
79
The second output is what I want but I don't like having to cast the char to a short. Is there a way to get the output I want without the cast?