strtoul()

Syntax

  #include <stdlib.h>


  
  unsigned long strtoul(const char *s,

  
                        char **end,

  
                        int base);

  
Description

strtoul() converts string s into an unsigned long int of base base, ignoring any white space at the beginning of s. It stops scanning when it reaches a character not matching the required syntax (or a character too large for a given base) and returns a pointer to that character in *end. strtoul() accepts the same number format as strtol() except that the negative sign is not allowed, and neither are the possible values for base.

Return

The number read. If no number is found, returns zero; if the value is larger than ULONG_MAX, returns ULONG_MAX and sets errno to ERANGE.

See also

atoi()

atol()

scanf()

strtod()

strtol()