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