Hex string to char

For example I have string that contains hexadecimal numbers:
std::string hexStr = "E110A3" and I want to convert it to char.
So that char hex[3] = {0xE1, 0x10, 0xA3}
How I can accomplish this?
I tried to search but I didn't find answer to this.

For example I have string that contains hexadecimal numbers:
std::string hexStr = "E110A3" and I want to convert it to char.
So that char hex[3] = {0xE1, 0x10, 0xA3}
How I can accomplish this?
I tried to search but I didn't find answer to this.

You need to first extract the two digit pairs from the string. Then you need to write a function that takes a two character string, representing a hexadecimal byte value and turn it into a number from 0 to 255 (does a char with a value over 127 have meaning?)

What is the best way to convert char to int (as you described low order to int 0-15)?
First thing that comes in my mind is to use if statements but that seems pretty stupid way.
Eg.
if(lowOrder = 'A') number = 10;

What is the best way to convert char to int (as you described low order to int 0-15)?
First thing that comes in my mind is to use if statements but that seems pretty stupid way.
Eg.
if(lowOrder = 'A') number = 10;

You would want == rather than = in the line above. The above would work but it would require that you have at least 16 if statement comparisons possibly, which is excessive. Take a look at the ASCII table.

You have three possibilities (assuming legal data). One, the character is 0 through 9. Two, the character is A - F (upper case). Three, the character is a - f (lower case). Anything else is illegal. Regarding the upper versus lower case, you can also either assume the character is upper case, or you can convert to upper case. The cctype library can be useful for this:

In particular, for your case, the following functions could be useful : toupper, isupper, isdigit, isalpha.

You do not NEED to use any of these functions however. You can instead convert directly using the ASCII code. To do so, figure out what the ascii offset would be. In the case of 'A' through 'F', the ascii offset would be 55. If you do use the cctype functions, you would not necessarily need to hard-code in these ASCII values.