CString to HEX
-
Hi How to convert a CString value to HEX? eg: CString strHex = "0008103e"; to HEX value = 0x0008103e please help Thanks
-
Hi How to convert a CString value to HEX? eg: CString strHex = "0008103e"; to HEX value = 0x0008103e please help Thanks
An hex value doesn't exist, what you want probably is to convert a string representing an integer in hexadecimal notation to an integer. For this you can use strtol[^] function.
Cédric Moonen Software developer
Charting control [v3.0] OpenGL game tutorial in C++ -
Hi How to convert a CString value to HEX? eg: CString strHex = "0008103e"; to HEX value = 0x0008103e please help Thanks
Benjamin Bruno wrote:
How to convert a CString value to HEX? eg: CString strHex = "0008103e"; to HEX value = 0x0008103e
What Cedric said.
ULONG nVal;
CString str = _T("0x4335");
nVal = _tcstol(str, NULL, 0);It was ever thus, the Neophiles will always rush out and get 'The Latest Thing' at a high price and with all the inherent faults - Dalek Dave.
-
Hi How to convert a CString value to HEX? eg: CString strHex = "0008103e"; to HEX value = 0x0008103e please help Thanks
You got excellent C answers. In C++ use the facilities of the Standard C++ Library:
#include <sstream>
int GetIntFromHexString(const char* HexString)
{
int val;
std::istringstream(HexString) >> std::hex >> val;
return val;
}cheers, AR
When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)