When you say "signed hex" you mean if you were to represent the bitwise representation of a char
in hexadecimal then F1
would be -15
. However, -15
in signed hex is simply -F
.
If you want to get -15
from this bitwise representation you'll have to do something like the following:
std::string szTest = "F1";
unsigned char chTest = std::stoi( szTest, nullptr, 16 );
char chTest2 = *reinterpret_cast<char*>(&chTest);
std::cout << szTest << ": " << static_cast<int>(chTest2) << std::endl;
return 0;