The strtoul function converts string
into an unsigned long value. The input string is a sequence of
characters that can be interpreted as an integer number. Whitespace
characters at the beginning of string are skipped.
An optional sign may precede the number.
The value of *ptr is set to point to the first
character in string immediately following the
converted part of string. If ptr is NULL, no value is assigned to *ptr. If no conversion is possible, *ptr
is set to the value of string and the value 0 is
returned by the strtol function.
If the base is zero, the syntax expected is
similar to that of integer constants, which is formed by a succession
of:
-
An optional prefix indicating octal ("0") or hexadecimal ("0x")
base.
-
A sequence of decimal digits (if no base prefix was specified)
or either octal or hexadecimal digits if a specific prefix is
present.
The radix of the number is deduced from its format.
If the value of base is in the range 2-36, the
number in string must consist of a non-zero
sequence of letters and digits representing an integer in the
specified base. The letters a-z (or A-Z) represent the values 10-36.
Only those letters representing values less than the base are
permitted. If the base is 16, the number may begin with 0x or 0X,
which is ignored.
The strtol function requires string to
have the following format:
〚whitespace〛 〚{+|-}〛 digits
Where
whitespace |
May be any whitespace characters. |
digits |
May be one or more decimal digits (0-9). |
|