Export (0) Print
Expand All
and
div
eof
not
or
xor
Expand Minimize

strtoull, _strtoull_l, wcstoull, _wcstoull_l

Visual Studio 2013

Converts strings to an unsigned long long-integer value.

unsigned long long strtoull(
   const char *nptr,
   char **endptr,
   int base 
);
unsigned long long _strtoull_l(
   const char *nptr,
   char **endptr,
   int base,
   _locale_t locale
);
unsigned long long wcstoull(
   const wchar_t *nptr,
   wchar_t **endptr,
   int base 
);
unsigned long long _wcstoull_l(
   const wchar_t *nptr,
   wchar_t **endptr,
   int base,
   _locale_t locale
);

nptr

Null-terminated string to convert.

endptr

Pointer to the character that stops the scan.

base

Number base to use.

locale

Locale to use.

strtoull returns the converted value, if any, or ULLONG_MAX on overflow. strtoull returns 0 if no conversion can be performed. wcstoull returns values analogously to strtoull. For both functions, errno is set to ERANGE if overflow or underflow occurs.

For more information about return codes, see errno, _doserrno, _sys_errlist, and _sys_nerr.

Each of these functions converts the input string nptr to an unsigned long long integer value.

strtoull stops reading the string nptr at the first character it cannot recognize as part of a number. This may be the terminating null character, or it may be the first numeric character that's greater than or equal to base. The setting of the LC_NUMERIC category of the locale determines recognition of the radix character in nptr; for more information, see setlocale, _wsetlocale. strtoull and wcstoull use the current locale; _strtoull_l and _wcstoull_l instead use the locale that's passed in but are identical otherwise. For more information, see Locale.

If endptr is not NULL, a pointer to the character that stopped the scan is stored at the location that's pointed to by endptr. If no conversion can be performed (no valid digits were found or an invalid base was specified), the value of nptr is stored at the location that's pointed to by endptr.

wcstoull is a wide-character version of strtoull and its nptr argument is a wide-character string. Otherwise, these functions behave identically.

Generic-Text Routine Mappings

TCHAR.H routine

_UNICODE & _MBCS not defined

_MBCS defined

_UNICODE defined

_tcstoull

strtoull

strtoull

wcstoull

_tcstoull_l

strtoull_l

_strtoull_l

_wcstoull_l

strtoull expects nptr to point to a string of the following form:

[whitespace] [{+ | }] [0 [{ x | X }]] [digits | [letters]]

A whitespace may consist of space and tab characters, which are ignored; digits are one or more decimal digits; letters are one or more of the letters 'a' through 'z' (or 'A' through 'Z'). The first character that does not fit this form stops the scan. If base is between 2 and 36, then it is used as the base of the number. If base is 0, the initial characters of the string that's pointed to by nptr are used to determine the base. If the first character is '0' and the second character is not 'x' or 'X', the string is interpreted as an octal integer. If the first character is '0' and the second character is 'x' or 'X', the string is interpreted as a hexadecimal integer. If the first character is '1' through '9', the string is interpreted as a decimal integer. The letters 'a' through 'z' (or 'A' through 'Z') are assigned the values 10 through 35; only letters whose assigned values are less than base are permitted. The first character outside the range of the base stops the scan. For example, if base is 0 and the first character scanned is '0', an octal integer is assumed and an '8' or '9' character stops the scan. strtoull allows a plus sign (+) or minus sign () prefix; a leading minus sign indicates that the return value is negated.

Routine

Required header

strtoull

<stdlib.h>

wcstoull

<stdlib.h> or <wchar.h>

_strtoull_l

<stdlib.h>

_wcstoull_l

<stdlib.h> or <wchar.h>

For additional compatibility information, see Compatibility.

See the example for strtod.

Show:
© 2014 Microsoft