CString sUnicode = _T("A123F");
CStringA sASCII(sUnicode);
char * pNotConverted=NULL;
long lHex = strtol (sASCII.operator LPCSTR(),&pNotConverted,16);
if(strlen(pNotConverted)>0)
return false;
- For unicode directly without conversion use wcstol the wide-character version
- For better range (__int64) use _strtoi64 or _wcstoi64
Remember the long limits
Type Name | Bytes | Range of Values |
long | 4 | –2,147,483,648 to 2,147,483,647 |
__int64 | 8 | –9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 |
Nessun commento:
Posta un commento