Guardian Native C Library Calls Reference Manual (G06.28+, H06.05+)
Guardian Native C Library Calls (s) strtoll(3)
converted:
Character 0123456789ABCDEFGHIJ
abcdefghij
Value 012345678910111213141516171819
The subject string can optionally be preceded by a + (plus sign) or - (minus sign), but cannot
include an integer suffix (such as L). If the subject string is preceded by a - (minus sign), the con-
verted integer value has a negative value. If the value of base is 16, the characters 0x or 0X may
optionally precede the sequence of letters or digits, following the sign, if present.
The character string is parsed to skip the initial space characters (as determined by the isspace()
function). Any nonspace character is the starting of a potential subject string that may form an
integer in the base specified by the base parameter. The subject sequence is defined to be the
longest initial substring that is of the expected form of long long integer. Any character that does
not satisfy this expected form begins the final sequence of unrecognized characters. The
strtoll() function sets the location pointed to by the endptr parameter to point to this final
sequence of unrecognized characters except when endptr is a null pointer.
The LC_CTYPE category of the locale controls what characters are treated as spaces but does
not effect the interpretation of characters as part of the subject string. The characters in the sub-
ject string are always treated as if the locale was the C/POSIX locale.
RETURN VALUES
The strtoll() function returns the converted value of long 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 outside the range of representable values, LLONG_MAX or LLONG_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), LLONG_MIN,orLLONG_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 strtoll() function sets errno to the corresponding
value:
[EINVAL] The base parameter has a value less than 0 (zero), equal to 1, or greater than 36.
[ERANGE] The converted value is outside the range of representable values.
If nptr is NULL, the function returns 0 (zero) and does not set errno.
RELATED INFORMATION
Functions: atof(3), atoi(3), atol(3), scanf(3), strtol(3), strtoul(3), strtoull(3), scanf(3), wstol(3).
527192-007 Hewlett-Packard Company 6−91