Jun 9, 2008 #1 Lorey Programmer Joined Feb 16, 2003 Messages 88 Location SG Hi Experts! Could somebody help me how to convert the "70" "ED" hex string character to actual 70 and ED value? FYI, i want to convert the 70ED to its corresponding chinese characters. thanks in advance! Lorna
Hi Experts! Could somebody help me how to convert the "70" "ED" hex string character to actual 70 and ED value? FYI, i want to convert the 70ED to its corresponding chinese characters. thanks in advance! Lorna
Jun 9, 2008 #2 xwb Programmer Joined Jul 11, 2002 Messages 6,828 Location GB The normal C way Code: char hexchars[] = "70ED"; unsigned int val; sscanf (hexchars, "%x", &val); Alternatively there is the C++ way Code: #include <iomanip> #include <sstream> ... std::istringstream iss; unsigned int val; iss.str ("70ED"); iss >> std::hex >> val; There are some MS specific ones like strtoi64 and StrToIntEx but I tend to stick to what's portable. Upvote 0 Downvote
The normal C way Code: char hexchars[] = "70ED"; unsigned int val; sscanf (hexchars, "%x", &val); Alternatively there is the C++ way Code: #include <iomanip> #include <sstream> ... std::istringstream iss; unsigned int val; iss.str ("70ED"); iss >> std::hex >> val; There are some MS specific ones like strtoi64 and StrToIntEx but I tend to stick to what's portable.