Definition | #include <stdlib.h> unsigned long int strtoul(const char *s, char **p, int base);
All control characters for white space may be used for tab (see definition under 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.
A third argument, base, defines the base (e.g. decimal, octal or hexadecimal) for the conversion. | |||||||
Parameters | const char *s Pointer to the string to be converted. char **p A pointer (*p) to the first character in s that terminates the conversion is returned if p is not a NULL pointer. int base Integer from 0 to 36, which is to be used as the base for the computation. From base 11 to base 36, letters a (or A) to z (or Z) in the string to be converted are assumed to be digits with the corresponding values 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:
If the parameter base = 16 is used for calculations, the characters 0X and 0x in string s are ignored. | |||||||
Return val. | Integer value of type | |||||||
for strings that have a structure as described above and represent a numeric value. | ||||||||
0 | for strings that do not conform to the syntax described above. No conversion is performed. | |||||||
ULONG_MAX | if the result overflows, | |||||||
See also | atol, atoll, atoi, strtol, strtoll, stroull, wcstol, wcstoll, wcstoul, wcstoull |