CRE Programmer's Guide
String and Memory Block Functions
Common Run-Time Environment (CRE) Programmer’s Guide—528146-004
8-4
Stcarg
Return Value
The Atoi, Atol, and Atof functions return the converted value of str. They return zero if
the first non-white-space character in
str is not a sign character (“+” or “-”), a decimal
digit, or, for Atof, a decimal point.
Considerations
•
The Atoi, Atol, and Atof functions skip leading white-space characters in str.
•
The first non-white-space character can be optionally a plus sign or a minus sign.
•
For Atof only, the first non-white-space character can be a decimal point.
•
The functions convert successive characters until they encounter either a non-
decimal character or a zero (null) byte.
Example
STRING .s[0:17] := [" 275",0];
INT i;
STRING .t[0:17] := [" 275.9E2",0];
REAL(64) r;
i := RTL_Atoi_(s); ! i gets 275
r := RTL_Atof_(t); ! r gets 27590
Stcarg
The Stcarg functions scan a character string until any character that appears in a
second string is encountered in the first string. These functions are not available in the
native CRE library.
str
is a pointer to the string to scan.
stop_chars
is a pointer to a string containing the characters to scan for in str.
INT PROC RTL_Stcarg_( str, stop_chars );
STRING .str; ! in
STRING .stop_chars; ! in TNS only
INT(32) PROC RTL_StcargX_( str, stop_chars );
STRING .EXT str; ! in
STRING .EXT stop_chars; ! in TNS only