Open System Services Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)

OSS Library Calls (s) strtoumax(3)
NAME
strtoumax - Converts a character string to a uintmax_t integer
LIBRARY
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 <inttypes.h>
uintmax_t strtoumax (
const char *nptr,
char **endptr,
int base);
PARAMETERS
nptr Points to the character string to convert.
endptr Points to a pointer in which the function stores the position in the string specified
by the nptr parameter where a character is found that is not a valid character for
the purpose of this conversion.
base Specifies the radix to use for the conversion.
DESCRIPTION
The strtoumax( ) function converts the initial portion of the character string pointed to by the
nptr parameter to a uintmax_t integer representation. The input character string is first broken
down into three parts:
white space An initial (possibly empty) sequence of spaces (as specified by the isspace( )
function for the C/POSIX locale)
subject sequence
A sequence of characters that are valid in an integer constant of the radix deter-
mined by the base parameter
unrecognized characters
A final sequence of unrecognized character codes, including the terminating null
character
If possible, the subject is then converted to an integer and the result is returned.
The base parameter can take values of 0 (zero) or between 2 and 36:
If the base value is 0 (zero), the subject string can be a decimal, octal, or hexadecimal
integer constant. A decimal constant begins with a nonzero digit, and consists of a
sequence of decimal digits. An octal constant consists of the prefix 0 (zero) optionally
followed by a sequence of digits in the range 0 through 7. A hexadecimal constant con-
sists of the prefix 0x or 0X followed by a sequence consisting of decimal digits and the
letters in the range a or A to f or F.
If the base value is between 2 and 36, the subject string can be a sequence of digits and
letters a or A to z or Z that are used to represent an integer in the specified base. Alpha-
betic characters represent digits with an equivalent decimal value from 10 (for the letter
A) to 35 (for the letter Z). The subject string can only have digits with a value less than
base and alphabetic characters with equivalent values less than base. For example, when
the value of the base parameter is 20, only the following value assignments are con-
verted:
527187-017 Hewlett-Packard Company 6195