CRE Programmer's Guide

String and Memory Block Functions
Common Run-Time Environment (CRE) Programmer’s Guide528146-004
8-30
Strtoul
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. Strtol treats uppercase and lowercase alphabetic
characters in
str interchangeably.
If base is less than 0, equal to 1, or greater than 36, the Strtol functions do not
convert
str. They return zero and end_scan points to the same location as
str.
Return Value
The Strtol functions return the converted value.
Considerations
str must be terminated by a zero (null) byte to stop the scan.
Leading white space is skipped.
str is a string of digits, optionally preceded by a sign.
Scanning stops if a character is encountered that is not valid for base.
Example
STRING .s[0:7] := ["21B43",0];
STRING .end;
INT(32) d;
! d gets 138051, the decimal equivalent of hex 21B43.
! @end gets @s[5]
d := CRE_Strtol_(s, @end, 16);
Strtoul
The Strtoul functions convert a string of characters to an unsigned 32-bit integer using
a specified base.
str
points to the string to convert.
INT(32) PROC CRE_Strtoul_( str, end_scan, base );
STRING .str; ! in
INT .end_scan; ! out
INT base; ! in TNS only
INT(32) PROC CRE_StrtoulX_( str, end_scan, base );
STRING .EXT str; ! in
INT(32) .EXT end_scan; ! out
INT base; ! in TNS only