The strtoul function

Name

strtoul -- 

Synopsis

#include <stdlib.h>

unsigned long strtoul (const char *nptr, char **endptr, int base);

Description

The strtoul function converts the initial portion of the string pointed to by nptr to unsigned long int representation. First it decomposes the input string into three parts: an initial, possibly empty, sequence of white space characters (as specified by the The isspace function, a subject sequence resembling an unsigned integer represented in some radix determined by the value of base, and a final string of one or more unrecognized characters, including the terminating null character of the input string. Then it attempts to convert the subject sequence to an unsigned integer, and returns the result.

Returns

The strtoul function returns the converted value, if any. If no conversion could be performed, zero is returned. If the correct value is outside the range of representable values, ULONG_MAX is returned, and the value of the macro ERANGE is is stored in errno.