Guardian Native C Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)
Guardian Native C Library Calls (s) strtoumax(3)
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 integer. Any character that does not
satisfy this expected form begins the final sequence of unrecognized characters. The
strtoumax() 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.
In the TNS/E native environment, all locales are supported.
RETURN VALUES
The strtoumax() function returns the converted value of uintmax_t 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, ULONG_MAX is returned.
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) and ULONG_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 strtoumax() function sets errno to the correspond-
ing 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), strtoumaxl(3), scanf(3), wcstol(3).
STANDARDS CONFORMANCE
The behavior of this function conforms to ISO/IEC 9899:1999 specification.
527192-018 Hewlett-Packard Company 6−145