Guardian C Library Calls Reference Manual
Reference to Library Calls
Guardian TNS C Library Calls Reference Manual—128833 3-177
stcd_l (supplementary)
stcd_l (supplementary)
The stcd_l function converts a string of decimal characters to a long integer.
str_ptr
points to the string to convert.
int_ptr
points to the variable of type long where stcd_l stores the converted value.
Return Value
is the number of characters scanned.
Usage Guidelines
•
The string to convert can contain an optional sign and then a string of digits.
•
The stcd_l function does not skip leading space characters.
•
The stcd_l function halts scanning when it encounters a non-decimal character.
Example
This example converts the string “1234567” to a long integer:
#include <stdlibh>
#include <stdioh>
int main(void)
{
char *string;
long result;
int count;
string = "1234567";
count = stcd_l(string, &result);
printf("%ld\n", result); /* prints "1234567" */
}
#include <stdlibh>
int stcd_l(char *str_ptr, long *int_ptr);