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

atoi(3) Guardian Native C Library Calls Reference Manual
NAME
atoi - Converts a character string to an 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>
int atoi(
const char *nptr);
PARAMETERS
nptr Points to the character string to convert.
DESCRIPTION
The atoi() 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 an 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 int value of the input string is
returned.
In the TNS environment, the atoi(), function supports the C/POSIX locale only. In the native
environment, all locales are supported.
NOTES
The atoi() function is subsumed by the strtol() function. If the number is not known to be in
range, strtol() should be used because atoi() is not required to perform any error checking.
RETURN VALUES
The atoi() function returns the converted value of an 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 outside
the range of representable values, INT_MAX or INT_MIN is returned (according to the sign of
the value).
Because this function returns 0 (zero), INT_MIN,orINT_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 return values are dened.
RELATED INFORMATION
Functions: atof(3), atol(3), scanf(3), strtol(3), strtoul(3), strtoull(3), wstol(3).
150 Hewlett-Packard Company 527192-018