2 .\" Copyright (c) 2001, The IEEE and The Open Group. All Rights Reserved. Portions Copyright (c) 2004, Sun Microsystems, Inc. All Rights Reserved.
3 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
4 .\" http://www.opengroup.org/bookstore/.
5 .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
6 .\" This notice shall appear on any product containing this material.
7 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
8 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
9 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
10 .TH INTTYPES.H 3HEAD "Sep 10, 2004"
12 inttypes.h, inttypes \- fixed size integer types
16 #include <\fBinttypes.h\fR>
22 The <\fBinttypes.h\fR> header includes the <\fBstdint.h\fR> header.
25 The <\fBinttypes.h\fR> header includes a definition of the following type:
32 structure type that is the type of the value returned by the \fBimaxdiv()\fR
38 The following macros are defined. Each expands to a character string literal
39 containing a conversion specifier, possibly modified by a length modifier,
40 suitable for use within the format argument of a formatted input/output
41 function when converting the corresponding integer type. These macros have the
42 general form of \fBPRI\fR (character string literals for the \fBfprintf()\fR
43 and \fBfwprintf()\fR family of functions) or \fBSCN\fR (character string
44 literals for the \fBfscanf()\fR and \fBfwscanf()\fR family of functions),
45 followed by the conversion specifier, followed by a name corresponding to a
46 similar type name in <\fBstdint.h\fR>. In these names, \fIN\fR represents the
47 width of the type as described in <\fBstdint.h\fR>. For example,
48 \fBPRIdFAST32\fR can be used in a format string to print the value of an
49 integer of type \fBint_fast32_t\fR.
52 The \fBfprintf()\fR macros for signed integers are:
56 PRId\fIN\fR PRIdLEAST\fIN\fR PRIdFAST\fIN\fR PRIdMAX PRIdPTR
57 PRIi\fIN\fR PRIiLEAST\fIN\fR PRIiFAST\fIN\fR PRIiMAX PRIiPTR
63 The \fBfprintf()\fR macros for unsigned integers are:
67 PRIo\fIN\fR PRIoLEAST\fIN\fR PRIoFAST\fIN\fR PRIoMAX PRIoPTR
68 PRIu\fIN\fR PRIuLEAST\fIN\fR PRIuFAST\fIN\fR PRIuMAX PRIuPTR
69 PRIx\fIN\fR PRIxLEAST\fIN\fR PRIxFAST\fIN\fR PRIxMAX PRIxPTR
70 PRIX\fIN\fR PRIXLEAST\fIN\fR PRIXFAST\fIN\fR PRIXMAX PRIXPTR
76 The \fBfscanf()\fR macros for signed integers are:
80 SCNd\fIN\fR SCNdLEAST\fIN\fR SCNdFAST\fIN\fR SCNdMAX SCNdPTR
81 SCNi\fIN\fR SCNiLEAST\fIN\fR SCNiFAST\fIN\fR SCNiMAX SCNiPTR
87 The \fBfscanf()\fR macros for unsigned integers are:
91 SCNo\fIN\fR SCNoLEAST\fIN\fR SCNoFAST\fIN\fR SCNoMAX SCNoPTR
92 SCNu\fIN\fR SCNuLEAST\fIN\fR SCNuFAST\fIN\fR SCNuMAX SCNuPTR
93 SCNx\fIN\fR SCNxLEAST\fIN\fR SCNxFAST\fIN\fR SCNxMAX SCNxPTR
99 For each type that the implementation provides in <\fBstdint.h\fR>, the
100 corresponding \fBfprintf()\fR and \fBfwprintf()\fR macros must be defined. The
101 corresponding \fBfscanf()\fR and \fBfwscanf()\fR macros must be defined as
102 well, unless the implementation does not have a suitable modifier for the type.
106 The purpose of <\fBinttypes.h\fR> is to provide a set of integer types whose
107 definitions are consistent across machines and independent of operating systems
108 and other implementation idiosyncrasies. It defines, with a \fBtypedef\fR,
109 integer types of various sizes. Implementations are free to \fBtypedef\fR them
110 as ISO C standard integer types or extensions that they support. Consistent use
111 of this header greatly increases the portability of applications across
115 \fBExample 1 \fRUse of Macro
118 The following code uses one of the macros available through <\fBinttypes.h\fR>.
123 #include <inttypes.h>
127 uintmax_t i = UINTMAX_MAX; // This type always exists.
128 wprintf("The largest integer value is %020"
138 See \fBattributes\fR(5) for descriptions of the following attributes:
146 ATTRIBUTE TYPE ATTRIBUTE VALUE
148 Interface Stability Standard
154 \fBimaxdiv\fR(3C), \fBattributes\fR(5), \fBstandards\fR(5)