JTC1/SC22/WG14
N602
N602 (X3J11/96-066)
The strtoimax() and strtoumax() Functions
John W Kwan
09 Sept 1996
The following has been reviewed by an editorial review committee and is
based on C9X draft 6 (N559).
Section 7.4.11 The following macros convert from strings to the
largest supported integral types.
Section 7.4.11.1 The strtoimax macro
Synopsis
#include <inttypes.h>
intmax_t strtoimax (const char *nptr, char **endptr, int base)
Description
The strtoimax macro converts the initial portion of the
string pointed to by nptr to the largest supported
signed integral representation of the implementation.
Returns
The strtoimax macro returns the converted value, if any. If no
conversion could be performed zero is returned. If the correct
value is outside the range of representable values, INTMAX_MAX or
INTMAX_MIN is returned (according to the sign of the value), and
the value of the macro ERANGE is stored in errno.
Section 7.4.11.2 The strtoumax macro
Synopsis
#include <inttypes.h>
uintmax_t strtoumax (const char *nptr, char **endptr, int base);
Description
The strtoumax macro converts the initial portion of the
string pointed to by nptr to the largest supported
unsigned integral representation of the implementation.
(see footnote)
Returns
The strtoumax macro returns the converted value, if any. If no
conversion could be performed zero is returned. If the correct
value is outside the range of representable values, UINTMAX_MAX
is returned, and the value of the macro ERANGE is stored in errno.