CRE Programmer's Guide
String and Memory Block Functions
Common Run-Time Environment (CRE) Programmer’s Guide—528146-004
8-31
Strtoul
end_scan
is the address within str where the conversion ended. The pointer returned
through
end_scan points to the character immediately after the last converted
character.
base
specifies the radix of the digits at str. It must be in the range:
0 less than or equal
base less than or equal to 36
•
If base is zero, the leading characters of str determine the radix:
°
0X or 0x indicates a hexadecimal number.
°
0 indicates an octal number.
°
1 through 9 indicate a decimal number.
•
If base is greater than 1 and less than or equal to 36, it specifies the radix of
the string of characters at
str. For values of base greater than 10, the letter A
represents 10, the letter B represents 11, and so forth, through the letter Z
which represents 35. Strtoul treats uppercase and lowercase alphabetic
characters in
str interchangeably.
•
If base is less than 0, equal to 1, or greater than 36, the Strtoul functions do
not convert
str and return zero. end_scan points to the same location as
str.
Return Value
The Strtoul functions return:
•
The 32-bit converted value if the conversion is successful.
•
Zero if they cannot convert the string.
•
The highest value that can be represented in 32 bits if the converted value would
cause overflow.
Considerations
•
Strtoul skips leading white-space characters.
•
Strtoul stops scanning if it encounters a character that is not valid for base.