Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hex value

Status
Not open for further replies.

Lorey

Programmer
Feb 16, 2003
88
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
 
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top