Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

strtoull - convert string to unsigned long long

&pagelevel(4)&pagelevel

Syntax

#include <stdlib.h>

unsigned long long int strtoull(const char *s, char **entptr, int base); 

Description

strtoull() converts the string to which s points into an integer of type unsigned long long int. The string to be converted may be structured as follows:

[{tab | 'BLANK'} ...][{0 | 0X}]digit...

Any white-space character may be used for tab (see definition under isspace()).

Depending on the base (see base), the digits 0 to 9 and the letters a (or A) to z (or Z) may be used for digit.

strtoull() also recognizes strings that begin with convertible digits (including octal and hexadecimal digits) but end with some other characters. In such cases, strtoull() truncates the numeric part before converting it.

strtoul() also returns a pointer to the first non-convertible character in string s via the second argument endptr of type char **, but only if endptr is not passed as a null pointer.

If no conversion is possible at all, *endptr is set to the start address of string s.

A third argument, base, defines the base (e.g. decimal, octal or hexadecimal) for the conversion.

The function has the following parameters:

const char *s

Pointer to the EBCDIC string to be converted.

char **endptr

If endptr is not a null pointer, a pointer (*endptr) to the first character in s is returned that terminates the conversion.
If no conversion is possible, *endptr is set to the start address of the string s.

int base

Integer from 0 to 36 that is to be used as the base for the calculation.

For base 11 to base 36, the letters a (or A) to z (or Z) in the string to be converted are assumed to be digits, with corresponding values from 10 (a/A) to 35 (z/Z).

If base is equal to 0, the base will be determined from the structure of string s as shown below:

leading 0

base 8

leading 0X or 0x

base 16

otherwise

base 10

If the parameter base = 16 is used for calculations, the characters 0X or 0x in string s will be ignored.

Return val.

Integer value of type unsigned long long int



for strings that have a structure as described above and which represent a numeric value.


0

for strings that do not conform to the syntax described above. No conversion is performed. If the value of base is not supported, errno is set to EINVAL.

 

ULLONG_MAX

if the result overflows. errno is set to ERANGE.

See also

atol(), atoll(), atoi(), strtol(), strtoll(), stroul(), wcstol(), wcstoll(), wcstoul(), wcstoull().