How can I change a hex character, not string, into a numerical value?
While typing this question, I found many answers on how to convert hex strings to values. Howe
You already have a solution that works with strings. Use it for chars too:
char
#include #include #include #include using namespace std; int main() { char val = 'A'; unsigned int myval; std::stringstream ss; ss << val; ss >> std::hex >> myval; cout << myval << endl; }
Code