Open System Services Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)
wcstol(3) OSS Library Calls Reference Manual
RETURN VALUES
The wcstol( ) 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, wcstol( ) stores a pointer to the final sequence of
unrecognized characters in *endptr except when the subject sequence is empty or invalid. In this
case, wcstol( ) stores the nptr pointer in the *endptr parameter.
Since 0 (zero), LONG_MIN, and LONG_MAX are returned in the event of an error and are also
valid returns if the wcstol( ) function is successful, applications should set errno to 0 (zero)
before calling the wcstol( ) function, and check errno after return from the wcstol( ) 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 occur, the wcstol( ) function sets errno to the corresponding
value.
[EINVAL] The base parameter has a value less than 0 or greater than 36.
The nptr parameter is a null pointer.
[ERANGE] The converted value is outside the range of representable values.
RELATED INFORMATION
Functions: atoi(3), strtol(3), scanf(3), wcstod(3), iswalnum(3).
8−38 Hewlett-Packard Company 527187-017