Hello. I have searched for a long time now, but i'm stumped. How can I change the string 0xff00ff or whatever to the int 0xff00ff? I tried all of the normal converting methods, but can't seem to get this to work. You guys are my last hope. Thanks.
Printable View
Hello. I have searched for a long time now, but i'm stumped. How can I change the string 0xff00ff or whatever to the int 0xff00ff? I tried all of the normal converting methods, but can't seem to get this to work. You guys are my last hope. Thanks.
How would you do it manually?
Take the digit characters one at a time from the left and get their hex value and use those hex values to build the int value.
First problem is converting a digit character to a hex value. '0' is 0, 'a' is 10
Once you have the hex value then think about how to build the final value given a string of hex values left to right.
Think about how its done with a decimal number. Given "123" you'd get the 1 first and then multiply that by 10 and add the 2 and then multiply that by 10 and add the 3 giving 123.