Merge commit 'dc97a43d4a70c8773a619f11b95b07a787f6f5b7' into merges
[unleashed.git] / share / man / man3head / inttypes.h.3head
blob69754e9e0d6e54e1f02af3f41a74301968b66815
1 '\" te
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"
11 .SH NAME
12 inttypes.h, inttypes \- fixed size integer types
13 .SH SYNOPSIS
14 .LP
15 .nf
16 #include <\fBinttypes.h\fR>
17 .fi
19 .SH DESCRIPTION
20 .sp
21 .LP
22 The <\fBinttypes.h\fR> header includes the <\fBstdint.h\fR> header.
23 .sp
24 .LP
25 The <\fBinttypes.h\fR> header includes a definition of the following type:
26 .sp
27 .ne 2
28 .na
29 \fB\fBimaxdiv_t\fR\fR
30 .ad
31 .RS 13n
32 structure type that is the type of the value returned by the \fBimaxdiv()\fR
33 function.
34 .RE
36 .sp
37 .LP
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.
50 .sp
51 .LP
52 The \fBfprintf()\fR macros for signed integers are:
53 .sp
54 .in +2
55 .nf
56 PRId\fIN\fR  PRIdLEAST\fIN\fR  PRIdFAST\fIN\fR  PRIdMAX  PRIdPTR
57 PRIi\fIN\fR  PRIiLEAST\fIN\fR  PRIiFAST\fIN\fR  PRIiMAX  PRIiPTR
58 .fi
59 .in -2
61 .sp
62 .LP
63 The \fBfprintf()\fR macros for unsigned integers are:
64 .sp
65 .in +2
66 .nf
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
71 .fi
72 .in -2
74 .sp
75 .LP
76 The \fBfscanf()\fR macros for signed integers are:
77 .sp
78 .in +2
79 .nf
80 SCNd\fIN\fR  SCNdLEAST\fIN\fR  SCNdFAST\fIN\fR  SCNdMAX  SCNdPTR
81 SCNi\fIN\fR  SCNiLEAST\fIN\fR  SCNiFAST\fIN\fR  SCNiMAX  SCNiPTR
82 .fi
83 .in -2
85 .sp
86 .LP
87 The \fBfscanf()\fR macros for unsigned integers are:
88 .sp
89 .in +2
90 .nf
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
94 .fi
95 .in -2
97 .sp
98 .LP
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.
103 .SH USAGE
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
112 platforms.
113 .SH EXAMPLES
115 \fBExample 1 \fRUse of Macro
118 The following code uses one of the macros available through <\fBinttypes.h\fR>.
121 .in +2
123 #include <inttypes.h>
124 #include <wchar.h>
125 int main(void)
127      uintmax_t i = UINTMAX_MAX; // This type always exists.
128      wprintf("The largest integer value is %020"
129           PRIxMAX, "\en", i);
130      return 0;
133 .in -2
135 .SH ATTRIBUTES
138 See \fBattributes\fR(5) for descriptions of the following attributes:
143 box;
144 c | c
145 l | l .
146 ATTRIBUTE TYPE  ATTRIBUTE VALUE
148 Interface Stability     Standard
151 .SH SEE ALSO
154 \fBimaxdiv\fR(3C), \fBattributes\fR(5), \fBstandards\fR(5)