Format
#include <stdlib.h> unsigned long long int strtoull(const char *string1, char **string2, int base);
Language Level: Extension
strtoull converts a character string to an unsigned long long
integer value. The input string1 is a sequence of
characters that can be interpreted as a numerical value of the
type unsigned long long int. strtoull stops reading the string at
the first character that it cannot recognize as part of a number.
This character can be the first numeric character greater than or
equal to the base. strtoull sets string2 to
point to the resulting output string if a conversion is
performed, and provided that string2 is not a NULL
pointer.
When you use strtoull, string1 should point to a string with the following form:

If base is in the range of 2 through 36, it becomes the base of the number. If base is 0, the prefix determines the base (8, 16, or 10): the prefix 0 means base 8 (octal); the prefix 0x or 0X means base 16 (hexadecimal); using any other digit without a prefix means decimal.
Return Value
strtoull returns the value represented in the string, or
0 if no conversion could be performed. For an overflow, strtoull
returns ULONGLONG_MAX and sets errno to ERANGE. If base
is not a valid number, strtoull sets errno to EDOM.
Example
This example converts the string to an unsigned long
long value. It prints out the converted value and the substring
that stopped the conversion.
#include <stdio.h> #include <stdlib.h>
#define BASE 2
int main(void)
{
char *string,*stopstring;
unsigned long long ull;
string = "1000e13 e";
printf("string = %s\n", string);
ull = strtoull(string, &stopstring, BASE);
printf(" strtoull = %lld (base %d)\n", ull, BASE);
printf(" Scan stopped at %s\n\n", stopstring);
return 0;
/***************************************************
The output should be:
string = 1000e13 e
strtoul = 8 (base 2)
Scan stopped at e13 e
***************************************************/
}
![]()
atof -- Convert Character String to Float
atoi -- Convert Character String to
Integer
atol -- Convert Character String to Long
Integer
_atold -- Convert Character String to
Long Double
strtod -- Convert Character String to
Double
strtol -- Convert Character String to
Long Integer
strtoll -- Convert Character String to
Long Long Integer
strtold -- Convert String to Long
Double
_ultoa -- Convert Unsigned Long Integer
to String
wcstod -- Convert Wide-Character
String to Double
wcstol -- Convert Wide-Character to
Long Integer
wcstoul -- Convert Wide-Character
String to Unsigned Long
<stdlib.h>