CRE Programmer's Guide
Math Functions
Common Run-Time Environment (CRE) Programmer’s Guide—528146-004
7-26
Decimal_to_Int
Decimal_to_Int
The Decimal_to_Int functions convert a string of decimal digits represented in ASCII
characters to a binary value of type INT, INT(32), or INT(64). These functions are not
available in the native CRE library.
str
contains the ASCII string to convert. It can have a maximum of 19 characters. The
value is represented as a string of decimal digits in ASCII, possibly including a
sign. Table 7-5
on page 7-29 shows the representations for the sign.
len
specifies the number of characters in str.
result
contains the binary result. If result is not large enough to contain the converted
result,
result is undefined.
Return Value
The Decimal_to_Int functions return one of the following values:
Examples
STRING .EXT s[0:4];;
INT .EXT r[0:0];
INT PROC RTL_Decimal_to_Int16_( str, len, result );
STRING .EXT str; ! in
INT len; ! in
INT .EXT result; ! out TNS only
INT PROC RTL_Decimal_to_Int32_( str, len, result );
STRING .EXT str; ! in
INT len; ! in
INT(32) .EXT result; ! out TNS only
INT PROC RTL_Decimal_to_Int64_( str, len, result );
STRING .EXT str; ! in
INT len; ! in
INT(64) .EXT result; ! out TNS only
Return Value Meaning
0 The operation was successful.
1 The size of the destination was not large enough to hold the value.
2 len was less than 1 or greater than 19.
3 str contained nonnumeric data.