Guardian Native C Library Calls Reference Manual (G06.25+, H06.03+)
Guardian Native C Library Calls (s) strtol(3)
RETURN VALUES
The strtol() 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).
If the endptr parameter is not a null pointer, the function stores a pointer to the final sequence of
unrecognized characters in the object pointed to by endptr except when the subject sequence is
empty or invalid. In this case, the function stores the nptr pointer in the object pointed to by the
endptr parameter.
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.
Additionally, if 0 (zero) is returned, applications should check if the endptr parameter equals the
nptr parameter. In this case, there was no valid subject string.
ERRORS
If any of the following conditions occurs, the strtol() function sets errno to the corresponding
value:
[EINVAL] The base parameter has a value less than 0 (zero) or greater than 36.
If nptr is NULL, the function returns 0 (zero) and does not set errno.
[ERANGE] The converted value is outside the range of representable values.
RELATED INFORMATION
Functions: atof(3), atoi(3), atol(3), scanf(3), strtoll(3), strtoul(3), strtoull(3), scanf(3),
wstol(3).
STANDARDS CONFORMANCE
This function conforms with the XPG4 Specification, Version 2. The values returned for errno
are HP extensions to the specification.
527192-003 Hewlett-Packard Company 6−91