Name

wcstoul, wcstoull

Synopsis

Converts a wide string into an unsigned long (or unsigned long long) integer value

#include <wchar.h>
unsigned long intwcstoul( const wchar_t * restrict wcs,
                           wchar_t ** restrict endptr, int base );
unsigned long long int wcstoull( const wchar_t * restrict wcs,
                                 wchar_t ** restrict endptr,
                                 int base );     (C99)

The wcstoul() function attempts to interpret the wide string addressed by its first pointer argument, wcs, as an integer numeric value, and returns the result with the type unsigned long. wcstoull() is similar, but returns unsigned long long. These functions are the wide-string equivalents of strtoul() and strtoull(), and they work in the same way, except that they operate on strings of wchar_t rather than char. See the description for strtol() in this chapter.

If the resulting value is outside the range of the function’s type, then the return value is ULONG_MAX, depending on the sign (or ULLONG_MAX, for wcstoull()), and the errno variable is set to the value of ERANGE (“range error”).

Example

See the example for the analogous function wcstol() in this chapter.

See Also

wcstol(), wcstod(), wcstof(), and wcstold(); strtol() and strtoul()

Get C in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.