C examples for wchar.h:wcstoull
function
<cwchar> <wchar.h>
Convert wide string to unsigned long long integer
unsigned long long int wcstoull (const wchar_t* str, wchar_t** endptr, int base);
Parameter | Description |
---|---|
str | C wide string |
endptr | the next character in str after the numerical value. |
On success, the function returns the converted integral number as an unsigned long long int value.
For non valid conversion, a zero value is returned.
For out of range value, the function returns ULLONG_MAX defined in <climits>, and errno is set to ERANGE.
#include <wchar.h> int main ()/*from www .jav a2 s .c om*/ { wchar_t wsNumbers[] = L"123123123 7b06af00 100101010101010101010110101010001100000 0x6fdead"; wchar_t * pEnd; unsigned long long int ulli1, ulli2, ulli3, ulli4; ulli1 = wcstoull (wsNumbers,&pEnd,10); ulli2 = wcstoull (pEnd,&pEnd,16); ulli3 = wcstoull (pEnd,&pEnd,2); ulli4 = wcstoull (pEnd,NULL,0); wprintf (L"The decimal equivalents are: %llu, %llu, %llu and %llu.\n", ulli1, ulli2, ulli3, ulli4); return 0; }