一個好用的函式 wcstoul:把CString包含的字串轉換成整數
阿新 • • 發佈:2018-12-09
Convert strings to an unsigned long-integer value.
unsigned long wcstoul(
const wchar_t *nptr,
wchar_t **endptr,
int base
);
nptr Null-terminated string to convert.
endptr Pointer to character that stops scan.
base Number base to use.
Return Value ---------------------------------------------------------------
wcstoul returns the converted value, if any, or ULONG_MAX on overflow. wcstoul returns 0 if no conversion can be performed. errno is set to ERANGE if overflow or underflow occurs.Example ---------------------------------------------------------------------------
CString str = _T("0x44420816"); unsigned long ul = wcstoul(str, 0, 16); // ul = 0x44420816 str = _T("44420816"); ul = wcstoul(str, 0, 16); // ul = 0x44420816