1inttypes.h(3HEAD) Headers inttypes.h(3HEAD)
2
3
4
6 inttypes.h, inttypes - fixed size integer types
7
9 #include <inttypes.h>
10
11
13 The <inttypes.h> header includes the <stdint.h> header.
14
15
16 The <inttypes.h> header includes a definition of the following type:
17
18 imaxdiv_t structure type that is the type of the value returned by
19 the imaxdiv() function.
20
21
22
23 The following macros are defined. Each expands to a character string
24 literal containing a conversion specifier, possibly modified by a
25 length modifier, suitable for use within the format argument of a for‐
26 matted input/output function when converting the corresponding integer
27 type. These macros have the general form of PRI (character string lit‐
28 erals for the fprintf() and fwprintf() family of functions) or SCN
29 (character string literals for the fscanf() and fwscanf() family of
30 functions), followed by the conversion specifier, followed by a name
31 corresponding to a similar type name in <stdint.h>. In these names, N
32 represents the width of the type as described in <stdint.h>. For exam‐
33 ple, PRIdFAST32 can be used in a format string to print the value of an
34 integer of type int_fast32_t.
35
36
37 The fprintf() macros for signed integers are:
38
39 PRIdN PRIdLEASTN PRIdFASTN PRIdMAX PRIdPTR
40 PRIiN PRIiLEASTN PRIiFASTN PRIiMAX PRIiPTR
41
42
43
44 The fprintf() macros for unsigned integers are:
45
46 PRIoN PRIoLEASTN PRIoFASTN PRIoMAX PRIoPTR
47 PRIuN PRIuLEASTN PRIuFASTN PRIuMAX PRIuPTR
48 PRIxN PRIxLEASTN PRIxFASTN PRIxMAX PRIxPTR
49 PRIXN PRIXLEASTN PRIXFASTN PRIXMAX PRIXPTR
50
51
52
53 The fscanf() macros for signed integers are:
54
55 SCNdN SCNdLEASTN SCNdFASTN SCNdMAX SCNdPTR
56 SCNiN SCNiLEASTN SCNiFASTN SCNiMAX SCNiPTR
57
58
59
60 The fscanf() macros for unsigned integers are:
61
62 SCNoN SCNoLEASTN SCNoFASTN SCNoMAX SCNoPTR
63 SCNuN SCNuLEASTN SCNuFASTN SCNuMAX SCNuPTR
64 SCNxN SCNxLEASTN SCNxFASTN SCNxMAX SCNxPTR
65
66
67
68 For each type that the implementation provides in <stdint.h>, the cor‐
69 responding fprintf() and fwprintf() macros must be defined. The corre‐
70 sponding fscanf() and fwscanf() macros must be defined as well, unless
71 the implementation does not have a suitable modifier for the type.
72
74 The purpose of <inttypes.h> is to provide a set of integer types whose
75 definitions are consistent across machines and independent of operating
76 systems and other implementation idiosyncrasies. It defines, with a
77 typedef, integer types of various sizes. Implementations are free to
78 typedef them as ISO C standard integer types or extensions that they
79 support. Consistent use of this header greatly increases the portabil‐
80 ity of applications across platforms.
81
83 Example 1 Use of Macro
84
85
86 The following code uses one of the macros available through <int‐
87 types.h>.
88
89
90 #include <inttypes.h>
91 #include <wchar.h>
92 int main(void)
93 {
94 uintmax_t i = UINTMAX_MAX; // This type always exists.
95 wprintf("The largest integer value is %020"
96 PRIxMAX, "\n", i);
97 return 0;
98 }
99
100
102 See attributes(5) for descriptions of the following attributes:
103
104
105
106
107 ┌─────────────────────────────┬─────────────────────────────┐
108 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
109 ├─────────────────────────────┼─────────────────────────────┤
110 │Interface Stability │Standard │
111 └─────────────────────────────┴─────────────────────────────┘
112
114 imaxdiv(3C), attributes(5), standards(5)
115
116
117
118SunOS 5.11 10 Sep 2004 inttypes.h(3HEAD)