1STRTOIMAX(3P) POSIX Programmer's Manual STRTOIMAX(3P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
11
13 strtoimax, strtoumax — convert string to integer type
14
16 #include <inttypes.h>
17
18 intmax_t strtoimax(const char *restrict nptr, char **restrict endptr,
19 int base);
20 uintmax_t strtoumax(const char *restrict nptr, char **restrict endptr,
21 int base);
22
24 The functionality described on this reference page is aligned with the
25 ISO C standard. Any conflict between the requirements described here
26 and the ISO C standard is unintentional. This volume of POSIX.1‐2008
27 defers to the ISO C standard.
28
29 These functions shall be equivalent to the strtol(), strtoll(), str‐
30 toul(), and strtoull() functions, except that the initial portion of
31 the string shall be converted to intmax_t and uintmax_t representation,
32 respectively.
33
35 These functions shall return the converted value, if any.
36
37 If no conversion could be performed, zero shall be returned and errno
38 may be set to [EINVAL].
39
40 If the value of base is not supported, 0 shall be returned and errno
41 shall be set to [EINVAL].
42
43 If the correct value is outside the range of representable values,
44 {INTMAX_MAX}, {INTMAX_MIN}, or {UINTMAX_MAX} shall be returned (accord‐
45 ing to the return type and sign of the value, if any), and errno shall
46 be set to [ERANGE].
47
49 These functions shall fail if:
50
51 EINVAL The value of base is not supported.
52
53 ERANGE The value to be returned is not representable.
54
55 These functions may fail if:
56
57 EINVAL No conversion could be performed.
58
59 The following sections are informative.
60
62 None.
63
65 Since the value of *endptr is unspecified if the value of base is not
66 supported, applications should either ensure that base has a supported
67 value (0 or between 2 and 36) before the call, or check for an [EINVAL]
68 error before examining *endptr.
69
71 None.
72
74 None.
75
77 strtol(), strtoul()
78
79 The Base Definitions volume of POSIX.1‐2008, <inttypes.h>
80
82 Portions of this text are reprinted and reproduced in electronic form
83 from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
84 -- Portable Operating System Interface (POSIX), The Open Group Base
85 Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
86 cal and Electronics Engineers, Inc and The Open Group. (This is
87 POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the
88 event of any discrepancy between this version and the original IEEE and
89 The Open Group Standard, the original IEEE and The Open Group Standard
90 is the referee document. The original Standard can be obtained online
91 at http://www.unix.org/online.html .
92
93 Any typographical or formatting errors that appear in this page are
94 most likely to have been introduced during the conversion of the source
95 files to man page format. To report such errors, see https://www.ker‐
96 nel.org/doc/man-pages/reporting_bugs.html .
97
98
99
100IEEE/The Open Group 2013 STRTOIMAX(3P)