Guardian Native C Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)

Guardian Native C Library Calls (a - e) atol(3)
NAME
atol - Converts a character string to a long integer
LIBRARY
G-series native Guardian processes: $SYSTEM.SYSnn.ZCRTLSRL
G-series native OSS processes: /G/system/sysnn/zcrtlsrl
H-series and J-series native Guardian processes: $SYSTEM.ZDLLnnn.ZCRTLDLL
32-bit H-series and J-series OSS processes: /G/system/zdllnnn/zcrtldll
64-bit H-series and J-series OSS processes: /G/system/zdllnnn/ycrtldll
SYNOPSIS
#include <stdlib.h>
long int atol(
const char *nptr);
PARAMETERS
nptr Points to the character string to convert.
DESCRIPTION
The atol() function converts the character string pointed to by the nptr parameter up to the first
character inconsistent with the format of a decimal integer to a long integer data type. Leading
white-space characters are ignored. A call to this function is equivalent to a call to strtol(nptr,
(char**) NULL, 10), except that error handling is different. The long int value of the input
string is returned.
In the TNS environment, the atol() function supports the C/POSIX locale only. In the native
environment, all locales are supported.
NOTES
The atol() function is subsumed by the strtol() function. If the number is not known to be in
range, strtol() should be used because atol() is not required to perform any error checking.
RETURN VALUES
The atol() function returns the converted value of long integer if the expected form is found. If
no conversion could be performed, a value of 0 (zero) is returned. If the converted value is out-
side the range of representable values, LONG_MAX or LONG_MIN is returned (according to
the sign of the value).
Because this function returns 0 (zero), LONG_MIN,orLONG_MAX in the event of an error
and these values are also valid returns if the function is successful, applications should set errno
to 0 (zero) before calling this function, and check errno after return from the function. If errno
is nonzero, an error occurred.
ERRORS
No error values are dened for return.
RELATED INFORMATION
Functions: atof(3), atoi(3), scanf(3), strtol(3), strtoul(3), strtoull(3), scanf(3), wcstol(3).
527192-018 Hewlett-Packard Company 151