Is there in Windows API or in MFC any analog to atoh()
function?
atoh()
converts a string containing a hexadecimal number into an unsigned number like
unsigned x = atoh("A");
and x = 10 after the operation.
In Windows I have a CString, containing "A". How can I convert it to int?
long x = strtoul("A", (char **) NULL, 16);
// x will be 10 decimal
unsigned long ten = strtoul("a", NULL, 16);
should handle it, if you can get a plain old char *
-representation out of the CString. The accepted solution using strtoul()
does a signed conversion.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With