include 文件 <inttypes.h> 提供有助于使代码与显式指定大小的数据项兼容(无论编译环境如何)的常量、宏和派生类型。它包含用于处理 8 位、16 位、32 位和 64 位对象的机制。该文件是新的 1999 ISO/IEC C 标准的一部分,文件内容反映了导致它包含在 1999 ISO/IEC C 标准中的建议。文件即将更新,以便完全与 1999 ISO/IEC C 标准一致。<inttypes.h> 提供的基本功能包括:
-
定宽整型
-
诸如 uintptr_t 的有用类型
-
常量宏
-
限制
-
格式字符串宏
以下各节提供有关 <inttypes.h> 基本功能的更多信息。
定宽整型
<inttypes.h> 提供的定宽整型包括带符号整型(如 int8_t、int16_t、int32_t、int64_t) 和无符号整型(如 uint8_t、uint16_t、uint32_t、uint64_t)。
定义为可容纳规定位数的最短整型的派生类型包括 int_least8_t、int_least64_t、uint_least8_t、uint_least64_t 等。
对于循环计数器和文件描述符等操作,使用 int 或无符号 int 是安全的;对于数组索引,使用 long 也是安全的。但是,不应不加选择地使用这些定宽类型。可将定宽类型用于下列各项的显式二进制表示:
-
磁盘数据
-
通过数据线
-
硬件寄存器
-
二进制接口规范
-
二进制数据结构
诸如 unintptr_t 的有用类型
<inttypes.h> 文件包括大小足以容纳一个指针的带符号整型和无符号整型。这些类型以 intptr_t 和 uintptr_t 形式提供。此外,<inttypes.h> 还提供 intmax_t 和 uintmax_t,后两者是可用的最长(以位为单位)带符号整型和无符号整型。
使用 uintptr_t 类型作为指针的整型而非基本类型,如无符号 long。尽管在 ILP32 和 LP64 数据模型中,无符号 long 与指针的长度相同,但如果使用 uintptr_t,则在数据模型更改 时,只有 uintptr_t 的定义受影响。这使您的代码可移植到许多其他系统中。它也是在 C 中更清楚地表达意图的方式。
需要执行地址运算时,intptr_t 和 uintptr_t 类型对于强制转换指针非常有用。因此,应使用 intptr_t 和 uintptr_t 类型,而不是 long 或无符号 long。
常量宏
使用宏 INT8_C(c)、INT64_C(c)、UINT8_C(c)、UINT64_C(c) 等指定给定常量的大小和符号。基本上,必要时这些宏会在常量的末尾添上 l、ul、ll 或 ull。 例如,对于 ILP32,INT64_C(1) 会在常量 1 后面附加 ll;对于 LP64,则附加 l。
可使用 INTMAX_C(c) 和 UINTMAX_C(c) 宏使常量成为最长类型。这些宏对于指定7.3 转换为 LP64 数据类型模型中介绍的常量类型会非常有用。
限制
由 <inttypes.h> 定义的限制是用于指定各种整型的最小值和最大值的常量,其中包括每个定宽类型的最小值(如 INT8_MIN、INT64_MIN 等)和最大值(如 INT8_MAX、INT64_MAX 等)及其对应的无符号的最小值和最大值。
<inttypes.h> 文件还提供每个最短长度类型的最小值和最大值,其中包括 INT_LEAST8_MIN、INT_LEAST64_MIN、INT_LEAST8_MAX、INT_LEAST64_MAX 等及其对应的无符号的最小值和最大值。
最后,<inttypes.h> 还定义支持的最长整型的最小值和最大值,其中包括 INTMAX_MIN 和 INTMAX_MAX 及其对应的无符号的最小值和最大值。
格式字符串宏
<inttypes.h> 文件还包括指定 printf(3S) 和 scanf(3S) 格式说明符的宏。实质上,如果宏名称内置了参数的位数,这些宏将在格式说明符前面添加 l 或 ll,以便将参数 标识为 long 或 long long。
printf(3S) 的宏以十进制、八进制、无符号和十六进制格式输出最短和最长整型,如以下示例所示:
int64_t i; printf("i =%" PRIx64 "\n", i);
同样,scanf(3S) 的宏以十进制、八进制、无符号和十六进制格式读取最短和最长整型。
uint64_t u; scanf("%" SCNu64 "\n", &u);
不要不加区别地使用这些宏。最好将它们与定宽整型中介 绍的定宽类型一起使用。
[added with C99]
de>abs · div · imaxabs · imaxdiv · imaxdiv_t · strtoimax · strtoumax · wcstoimax · wcstoumax de>
de>PRId8 · PRId16 · PRId32 · PRId64 · PRIdFAST8 · PRIdFAST16 · PRIdFAST32 · PRIdFAST64 · PRIdLEAST8 · PRIdLEAST16 · PRIdLEAST32 · PRIdLEAST64 · PRIdMAX · PRIdPTR · PRIi8 · PRIi16 · PRIi32 · PRIi64 · PRIiFAST8 · PRIiFAST16 · PRIiFAST32 · PRIiFAST64 · PRIiLEAST8 · PRIiLEAST16 · PRIiLEAST32 · PRIiLEAST64 · PRIiMAX · PRIiPTR · PRIo8 · PRIo16 · PRIo32 · PRIo64 · PRIoFAST8 · PRIoFAST16 · PRIoFAST32 · PRIoFAST64 · PRIoLEAST8 · PRIoLEAST16 · PRIoLEAST32 · PRIoLEAST64 · PRIoMAX · PRIoPTR · PRIu8 · PRIu16 · PRIu32 · PRIu64 · PRIuFAST8 · PRIuFAST16 · PRIuFAST32 · PRIuFAST64 · PRIuLEAST8 · PRIuLEAST16 · PRIuLEAST32 · PRIuLEAST64 · PRIuMAX · PRIuPTR · PRIx8 · PRIx16 · PRIx32 · PRIx64 · PRIxFAST8 · PRIxFAST16 · PRIxFAST32 · PRIxFAST64 · PRIxLEAST8 · PRIxLEAST16 · PRIxLEAST32 · PRIxLEAST64 · PRIxMAX · PRIxPTR · PRIX8 · PRIX16 · PRIX32 · PRIX64 · PRIXFAST8 · PRIXFAST16 · PRIXFAST32 · PRIXFAST64 · PRIXLEAST8 · PRIXLEAST16 · PRIXLEAST32 · PRIXLEAST64 · PRIXMAX · PRIXPTR de>
de>SCNd8 · SCNd16 · SCNd32 · SCNd64 · SCNdFAST8 · SCNdFAST16 · SCNdFAST32 · SCNdFAST64 · SCNdLEAST8 · SCNdLEAST16 · SCNdLEAST32 · SCNdLEAST64 · SCNdMAX · SCNdPTR · SCNi8 · SCNi16 · SCNi32 · SCNi64 · SCNiFAST8 · SCNiFAST16 · SCNiFAST32 · SCNiFAST64 · SCNiLEAST8 · SCNiLEAST16 · SCNiLEAST32 · SCNiLEAST64 · SCNiMAX · SCNiPTR · SCNo8 · SCNo16 · SCNo32 · SCNo64 · SCNoFAST8 · SCNoFAST16 · SCNoFAST32 · SCNoFAST64 · SCNoLEAST8 · SCNoLEAST16 · SCNoLEAST32 · SCNoLEAST64 · SCNoMAX · SCNoPTR · SCNu8 · SCNu16 · SCNu32 · SCNu64 · SCNuFAST8 · SCNuFAST16 · SCNuFAST32 · SCNuFAST64 · SCNuLEAST8 · SCNuLEAST16 · SCNuLEAST32 · SCNuLEAST64 · SCNuMAX · SCNuPTR · SCNx8 · SCNx16 · SCNx32 · SCNx64 · SCNxFAST8 · SCNxFAST16 · SCNxFAST32 · SCNxFAST64 · SCNxLEAST8 · SCNxLEAST16 · SCNxLEAST32 · SCNxLEAST64 · SCNxMAX · SCNxPTR de>
Include the standard header de><inttypes.h>de> to include the standard header de><stdint.h>de> and to define a type, several functions, and numerous macros for fine control over the conversion of integers. Note that the definitions shown for the macros are merely representative — they can vary among implementations.
/* TYPE DEFINITIONS */
typedef struct {
intmax_t quot, rem;
}
imaxdiv_t;
/* FUNCTION DECLARATIONS */
intmax_t
imaxabs(intmax_t i);
intmax_t
abs(intmax_t i);
[C++ only]
imaxdiv_t
imaxdiv(intmax_t numer, intmax_t denom);
imaxdiv_t
div(intmax_t numer, intmax_t denom);
[C++ only]
intmax_t
strtoimax(const char *restrict s,
char **restrict endptr, int base);
uintmax_t
strtoumax(const char *restrict s,
char **restrict endptr, int base);
intmax_t
wcstoimax(const wchar_t *restrict s,
wchar_t **restrict endptr, int base);
uintmax_t
wcstoumax(const wchar_t *restrict s,
wchar_t **restrict endptr, int base);
/* PRINT FORMAT MACROS */
#define
PRId8 "hhd"
#define
PRId16 "hd"
#define
PRId32 "ld"
#define
PRId64 "lld"
#define
PRIdFAST8 "hhd"
#define
PRIdFAST16 "hd"
#define
PRIdFAST32 "ld"
#define
PRIdFAST64 "lld"
#define
PRIdLEAST8 "hhd"
#define
PRIdLEAST16 "hd"
#define
PRIdLEAST32 "ld"
#define
PRIdLEAST64 "lld"
#define
PRIdMAX "lld"
#define
PRIdPTR "lld"
#define
PRIi8 "hhi"
#define
PRIi16 "hi"
#define
PRIi32 "li"
#define
PRIi64 "lli"
#define
PRIiFAST8 "hhi"
#define
PRIiFAST16 "hi"
#define
PRIiFAST32 "li"
#define
PRIiFAST64 "lli"
#define
PRIiLEAST8 "hhi"
#define
PRIiLEAST16 "hi"
#define
PRIiLEAST32 "li"
#define
PRIiLEAST64 "lli"
#define
PRIiMAX "lli"
#define
PRIiPTR "lli"
#define
PRIo8 "hho"
#define
PRIo16 "ho"
#define
PRIo32 "lo"
#define
PRIo64 "llo"
#define
PRIoFAST8 "hho"
#define
PRIoFAST16 "ho"
#define
PRIoFAST32 "lo"
#define
PRIoFAST64 "llo"
#define
PRIoLEAST8 "hho"
#define
PRIoLEAST16 "ho"
#define
PRIoLEAST32 "lo"
#define
PRIoLEAST64 "llo"
#define
PRIoMAX "llo"
#define
PRIoPTR "llo"
#define
PRIu8 "hhu"
#define
PRIu16 "hu"
#define
PRIu32 "lu"
#define
PRIu64 "llu"
#define
PRIuFAST8 "hhu"
#define
PRIuFAST16 "hu"
#define
PRIuFAST32 "lu"
#define
PRIuFAST64 "llu"
#define
PRIuLEAST8 "hhu"
#define
PRIuLEAST16 "hu"
#define
PRIuLEAST32 "lu"
#define
PRIuLEAST64 "llu"
#define
PRIuMAX "llu"
#define
PRIuPTR "llu"
#define
PRIx8 "hhx"
#define
PRIx16 "hx"
#define
PRIx32 "lx"
#define
PRIx64 "llx"
#define
PRIxFAST8 "hhx"
#define
PRIxFAST16 "hx"
#define
PRIxFAST32 "lx"
#define
PRIxFAST64 "llx"
#define
PRIxLEAST8 "hhx"
#define
PRIxLEAST16 "hx"
#define
PRIxLEAST32 "lx"
#define
PRIxLEAST64 "llx"
#define
PRIxMAX "llx"
#define
PRIxPTR "llx"
#define
PRIX8 "hhX"
#define
PRIX16 "hX"
#define
PRIX32 "lX"
#define
PRIX64 "llX"
#define
PRIXFAST8 "hhX"
#define
PRIXFAST16 "hX"
#define
PRIXFAST32 "lX"
#define
PRIXFAST64 "llX"
#define
PRIXLEAST8 "hhX"
#define
PRIXLEAST16 "hX"
#define
PRIXLEAST32 "lX"
#define
PRIXLEAST64 "llX"
#define
PRIXMAX "llX"
#define
PRIXPTR "llX"
/* SCAN FORMAT MACROS */
#define
SCNd8 "hhd"
#define
SCNd16 "hd"
#define
SCNd32 "ld"
#define
SCNd64 "lld"
#define
SCNdFAST8 "hhd"
#define
SCNdFAST16 "hd"
#define
SCNdFAST32 "ld"
#define
SCNdFAST64 "lld"
#define
SCNdLEAST8 "hhd"
#define
SCNdLEAST16 "hd"
#define
SCNdLEAST32 "ld"
#define
SCNdLEAST64 "lld"
#define
SCNdMAX "lld"
#define
SCNdPTR "lld"
#define
SCNi8 "hhi"
#define
SCNi16 "hi"
#define
SCNi32 "li"
#define
SCNi64 "lli"
#define
SCNiFAST8 "hhi"
#define
SCNiFAST16 "hi"
#define
SCNiFAST32 "li"
#define
SCNiFAST64 "lli"
#define
SCNiLEAST8 "hhi"
#define
SCNiLEAST16 "hi"
#define
SCNiLEAST32 "li"
#define
SCNiLEAST64 "lli"
#define
SCNiMAX "lli"
#define
SCNiPTR "lli"
#define
SCNo8 "hho"
#define
SCNo16 "ho"
#define
SCNo32 "lo"
#define
SCNo64 "llo"
#define
SCNoFAST8 "hho"
#define
SCNoFAST16 "ho"
#define
SCNoFAST32 "lo"
#define
SCNoFAST64 "llo"
#define
SCNoLEAST8 "hho"
#define
SCNoLEAST16 "ho"
#define
SCNoLEAST32 "lo"
#define
SCNoLEAST64 "llo"
#define
SCNoMAX "llo"
#define
SCNoPTR "llo"
#define
SCNu8 "hhu"
#define
SCNu16 "hu"
#define
SCNu32 "lu"
#define
SCNu64 "llu"
#define
SCNuFAST8 "hhu"
#define
SCNuFAST16 "hu"
#define
SCNuFAST32 "lu"
#define
SCNuFAST64 "llu"
#define
SCNuLEAST8 "hhu"
#define
SCNuLEAST16 "hu"
#define
SCNuLEAST32 "lu"
#define
SCNuLEAST64 "llu"
#define
SCNuMAX "llu"
#define
SCNuPTR "llu"
#define
SCNx8 "hhx"
#define
SCNx16 "hx"
#define
SCNx32 "lx"
#define
SCNx64 "llx"
#define
SCNxFAST8 "hhx"
#define
SCNxFAST16 "hx"
#define
SCNxFAST32 "lx"
#define
SCNxFAST64 "llx"
#define
SCNxLEAST8 "hhx"
#define
SCNxLEAST16 "hx"
#define
SCNxLEAST32 "lx"
#define
SCNxLEAST64 "llx"
#define
SCNxMAX "llx"
#define
SCNxPTR "llx"
de>imaxabsde>,
de>absde> intmax_t
imaxabs(intmax_t i);
intmax_t
abs(intmax_t i);
[C++ only]
The function returns the absolute value of de>ide>, de>|i|de>.
de>imaxdivde>,
de>divde> imaxdiv_t
imaxdiv(intmax_t numer, intmax_t denom);
imaxdiv_t
div(intmax_t numer, intmax_t denom);
[C++ only]
The function divides de>numerde> by de>denomde> and returns both quotient and remainder in the structure result de>xde>, if the quotient can be represented. The structure member de>x.quotde> is the algebraic quotient truncated toward zero. The structure member de>x.remde> is the remainder, such that de>numer == x.quot*denom + x.remde>.
de>imaxdiv_tde> typedef struct {
intmax_t quot, rem;
}
imaxdiv_t;
The type is the structure type returned by the function de>imaxdivde>. The structure contains members that represent the quotient (de>quotde>) and remainder (de>remde>) of a signed integer division with operands of type intmax_t. The members shown above can occur in either order.
de>PRId8de>,
de>PRId16de>,
de>PRId32de>,
de>PRId64de> #define
PRId8 "hhd"
#define
PRId16 "hd"
#define
PRId32 "ld"
#define
PRId64 "lld"
The macros each expand to a string literal suitable for use as a de>dde> print conversion specificier, plus any needed qualifiers, to convert values of the types de>int8_tde>, de>int16_tde>, de>int32_tde>, or de>int64_tde>, respectively. Note that the definitions shown here are merely representative.
de>PRIdFAST8de>,
de>PRIdFAST16de>,
de>PRIdFAST32de>,
de>PRIdFAST64de> #define
PRIdFAST8 "hhd"
#define
PRIdFAST16 "hd"
#define
PRIdFAST32 "ld"
#define
PRIdFAST64 "lld"
The macros each expand to a string literal suitable for use as a de>dde> print conversion specificier, plus any needed qualifiers, to convert values of the types de>int_fast8_tde>, de>int_fast16_tde>, de>int_fast32_tde>, or de>int_fast64_tde>, respectively. Note that the definitions shown here are merely representative.
de>PRIdLEAST8de>,
de>PRIdLEAST16de>,
de>PRIdLEAST32de>,
de>PRIdLEAST64de> #define
PRIdLEAST8 "hhd"
#define
PRIdLEAST16 "hd"
#define
PRIdLEAST32 "ld"
#define
PRIdLEAST64 "lld"
The macros each expand to a string literal suitable for use as a de>dde> print conversion specificier, plus any needed qualifiers, to convert values of the types de>int_least8_tde>, de>int_least16_tde>, de>int_least32_tde>, or de>int_least64_tde>, respectively. Note that the definitions shown here are merely representative.
de>PRIdMAXde> #define
PRIdMAX "lld"
The macro expands to a string literal suitable for use as a de>dde> print conversion specificier, plus any needed qualifiers, to convert values of the types de>intmax_tde>. Note that the definition shown here is merely representative.
de>PRIdPTRde> #define
PRIdPTR "lld"
The macro expands to a string literal suitable for use as a de>dde> print conversion specificier, plus any needed qualifiers, to convert values of the types de>intptr_tde>. Note that the definition shown here is merely representative.
de>PRIi8de>,
de>PRIi16de>,
de>PRIi32de>,
de>PRIi64de> #define
PRIi8 "hhi"
#define
PRIi16 "hi"
#define
PRIi32 "li"
#define
PRIi64 "lli"
The macros each expand to a string literal suitable for use as an de>ide> print conversion specificier, plus any needed qualifiers, to convert values of the types de>int8_tde>, de>int16_tde>, de>int32_tde>, or de>int64_tde>, respectively. Note that the definitions shown here are merely representative.
de>PRIiFAST8de>,
de>PRIiFAST16de>,
de>PRIiFAST32de>,
de>PRIiFAST64de> #define
PRIiFAST8 "hhi"
#define
PRIiFAST16 "hi"
#define
PRIiFAST32 "li"
#define
PRIiFAST64 "lli"
The macros each expand to a string literal suitable for use as an de>ide> print conversion specificier, plus any needed qualifiers, to convert values of the types de>int_fast8_tde>, de>int_fast16_tde>, de>int_fast32_tde>, or de>int_fast64_tde>, respectively. Note that the definitions shown here are merely representative.
de>PRIiLEAST8de>,
de>PRIiLEAST16de>,
de>PRIiLEAST32de>,
de>PRIiLEAST64de> #define
PRIiLEAST8 "hhi"
#define
PRIiLEAST16 "hi"
#define
PRIiLEAST32 "li"
#define
PRIiLEAST64 "lli"
The macros each expand to a string literal suitable for use as an de>ide> print conversion specificier, plus any needed qualifiers, to convert values of the types de>int_least8_tde>, de>int_least16_tde>, de>int_least32_tde>, or de>int_least64_tde>, respectively. Note that the definitions shown here are merely representative.
de>PRIiMAXde> #define
PRIiMAX "lli"
The macro expands to a string literal suitable for use as an de>ide> print conversion specificier, plus any needed qualifiers, to convert values of the types de>intmax_tde>. Note that the definition shown here is merely representative.
de>PRIiPTRde> #define
PRIiPTR "lli"
The macro expands to a string literal suitable for use as an de>ide> print conversion specificier, plus any needed qualifiers, to convert values of the types de>intptr_tde>. Note that the definition shown here is merely representative.
de>PRIo8de>,
de>PRIo16de>,
de>PRIo32de>,
de>PRIo64de> #define
PRIo8 "hho"
#define
PRIo16 "ho"
#define
PRIo32 "lo"
#define
PRIo64 "llo"
The macros each expand to a string literal suitable for use as an de>ode> print conversion specificier, plus any needed qualifiers, to convert values of the types de>uint8_tde>, de>uint16_tde>, de>uint32_tde>, or de>uint64_tde>, respectively. Note that the definitions shown here are merely representative.
de>PRIoFAST8de>,
de>PRIoFAST16de>,
de>PRIoFAST32de>,
de>PRIoFAST64de> #define
PRIoFAST8 "hho"
#define
PRIoFAST16 "ho"
#define
PRIoFAST32 "lo"
#define
PRIoFAST64 "llo"
The macros each expand to a string literal suitable for use as an de>ode> print conversion specificier, plus any needed qualifiers, to convert values of the types de>uint_fast8_tde>, de>uint_fast16_tde>, de>uint_fast32_tde>, or de>uint_fast64_tde>, respectively. Note that the definitions shown here are merely representative.
de>PRIoLEAST8de>,
de>PRIoLEAST16de>,
de>PRIoLEAST32de>,
de>PRIoLEAST64de> #define
PRIoLEAST8 "hho"
#define
PRIoLEAST16 "ho"
#define
PRIoLEAST32 "lo"
#define
PRIoLEAST64 "llo"
The macros each expand to a string literal suitable for use as an de>ode> print conversion specificier, plus any needed qualifiers, to convert values of the types de>uint_least8_tde>, de>uint_least16_tde>, de>uint_least32_tde>, or de>uint_least64_tde>, respectively. Note that the definitions shown here are merely representative.
de>PRIoMAXde> #define
PRIoMAX "llo"
The macro expands to a string literal suitable for use as an de>ode> print conversion specificier, plus any needed qualifiers, to convert values of the types de>uintmax_tde>. Note that the definition shown here is merely representative.
de>PRIoPTRde> #define
PRIoPTR "llo"
The macro expands to a string literal suitable for use as an de>ode> print conversion specificier, plus any needed qualifiers, to convert values of the types de>uintptr_tde>. Note that the definition shown here is merely representative.
de>PRIu8de>,
de>PRIu16de>,
de>PRIu32de>,
de>PRIu64de> #define
PRIu8 "hhu"
#define
PRIu16 "hu"
#define
PRIu32 "lu"
#define
PRIu64 "llu"
The macros each expand to a string literal suitable for use as a de>ude> print conversion specificier, plus any needed qualifiers, to convert values of the types de>uint8_tde>, de>uint16_tde>, de>uint32_tde>, or de>uint64_tde>, respectively. Note that the definitions shown here are merely representative.
de>PRIuFAST8de>,
de>PRIuFAST16de>,
de>PRIuFAST32de>,
de>PRIuFAST64de> #define
PRIuFAST8 "hhu"
#define
PRIuFAST16 "hu"
#define
PRIuFAST32 "lu"
#define
PRIuFAST64 "llu"
The macros each expand to a string literal suitable for use as a de>ude> print conversion specificier, plus any needed qualifiers, to convert values of the types de>uint_fast8_tde>, de>uint_fast16_tde>, de>uint_fast32_tde>, or de>uint_fast64_tde>, respectively. Note that the definitions shown here are merely representative.
de>PRIuLEAST8de>,
de>PRIuLEAST16de>,
de>PRIuLEAST32de>,
de>PRIuLEAST64de> #define
PRIuLEAST8 "hhu"
#define
PRIuLEAST16 "hu"
#define
PRIuLEAST32 "lu"
#define
PRIuLEAST64 "llu"
The macros each expand to a string literal suitable for use as a de>ude> print conversion specificier, plus any needed qualifiers, to convert values of the types de>uint_least8_tde>, de>uint_least16_tde>, de>uint_least32_tde>, or de>uint_least64_tde>, respectively. Note that the definitions shown here are merely representative.
de>PRIuMAXde> #define
PRIuMAX "llu"
The macro expands to a string literal suitable for use as a de>ude> print conversion specificier, plus any needed qualifiers, to convert values of the types de>uintmax_tde>. Note that the definition shown here is merely representative.
de>PRIuPTRde> #define
PRIuPTR "llu"
The macro expands to a string literal suitable for use as a de>ude> print conversion specificier, plus any needed qualifiers, to convert values of the types de>uintptr_tde>. Note that the definition shown here is merely representative.
de>PRIx8de>,
de>PRIx16de>,
de>PRIx32de>,
de>PRIx64de> #define
PRIx8 "hhx"
#define
PRIx16 "hx"
#define
PRIx32 "lx"
#define
PRIx64 "llx"
The macros each expand to a string literal suitable for use as an de>xde> print conversion specificier, plus any needed qualifiers, to convert values of the types de>uint8_tde>, de>uint16_tde>, de>uint32_tde>, or de>uint64_tde>, respectively. Note that the definitions shown here are merely representative.
de>PRIxFAST8de>,
de>PRIxFAST16de>,
de>PRIxFAST32de>,
de>PRIxFAST64de> #define
PRIxFAST8 "hhx"
#define
PRIxFAST16 "hx"
#define
PRIxFAST32 "lx"
#define
PRIxFAST64 "llx"
The macros each expand to a string literal suitable for use as an de>xde> print conversion specificier, plus any needed qualifiers, to convert values of the types de>uint_fast8_tde>, de>uint_fast16_tde>, de>uint_fast32_tde>, or de>uint_fast64_tde>, respectively. Note that the definitions shown here are merely representative.
de>PRIxLEAST8de>,
de>PRIxLEAST16de>,
de>PRIxLEAST32de>,
de>PRIxLEAST64de> #define
PRIxLEAST8 "hhx"
#define
PRIxLEAST16 "hx"
#define
PRIxLEAST32 "lx"
#define
PRIxLEAST64 "llx"
The macros each expand to a string literal suitable for use as an de>xde> print conversion specificier, plus any needed qualifiers, to convert values of the types de>uint_least8_tde>, de>uint_least16_tde>, de>uint_least32_tde>, or de>uint_least64_tde>, respectively. Note that the definitions shown here are merely representative.
de>PRIxMAXde> #define
PRIxMAX "llx"
The macro expands to a string literal suitable for use as an de>xde> print conversion specificier, plus any needed qualifiers, to convert values of the types de>uintmax_tde>. Note that the definition shown here is merely representative.
de>PRIxPTRde> #define
PRIxPTR "llx"
The macro expands to a string literal suitable for use as an de>xde> print conversion specificier, plus any needed qualifiers, to convert values of the types de>uintptr_tde>. Note that the definition shown here is merely representative.
de>PRIX8de>,
de>PRIX16de>,
de>PRIX32de>,
de>PRIX64de> #define
PRIX8 "hhX"
#define
PRIX16 "hX"
#define
PRIX32 "lX"
#define
PRIX64 "llX"
The macros each expand to a string literal suitable for use as an de>Xde> print conversion specificier, plus any needed qualifiers, to convert values of the types de>uint8_tde>, de>uint16_tde>, de>uint32_tde>, or de>uint64_tde>, respectively. Note that the definitions shown here are merely representative.
de>PRIXFAST8de>,
de>PRIXFAST16de>,
de>PRIXFAST32de>,
de>PRIXFAST64de> #define
PRIXFAST8 "hhX"
#define
PRIXFAST16 "hX"
#define
PRIXFAST32 "lX"
#define
PRIXFAST64 "llX"
The macros each expand to a string literal suitable for use as an de>Xde> print conversion specificier, plus any needed qualifiers, to convert values of the types de>uint_fast8_tde>, de>uint_fast16_tde>, de>uint_fast32_tde>, or de>uint_fast64_tde>, respectively. Note that the definitions shown here are merely representative.
de>PRIXLEAST8de>,
de>PRIXLEAST16de>,
de>PRIXLEAST32de>,
de>PRIXLEAST64de> #define
PRIXLEAST8 "hhX"
#define
PRIXLEAST16 "hX"
#define
PRIXLEAST32 "lX"
#define
PRIXLEAST64 "llX"
The macros each expand to a string literal suitable for use as an de>Xde> print conversion specificier, plus any needed qualifiers, to convert values of the types de>uint_least8_tde>, de>uint_least16_tde>, de>uint_least32_tde>, or de>uint_least64_tde>, respectively. Note that the definitions shown here are merely representative.
de>PRIXMAXde> #define
PRIXMAX "llX"
The macro expands to a string literal suitable for use as an de>Xde> print conversion specificier, plus any needed qualifiers, to convert values of the types de>uintmax_tde>. Note that the definition shown here is merely representative.
de>PRIXPTRde> #define
PRIXPTR "llX"
The macro expands to a string literal suitable for use as an de>Xde> print conversion specificier, plus any needed qualifiers, to convert values of the types de>uintptr_tde>. Note that the definition shown here is merely representative.
de>SCNd8de>,
de>SCNd16de>,
de>SCNd32de>,
de>SCNd64de> #define
SCNd8 "hhd"
#define
SCNd16 "hd"
#define
SCNd32 "ld"
#define
SCNd64 "lld"
The macros each expand to a string literal suitable for use as a de>dde> scan conversion specificier, plus any needed qualifiers, to convert values of the types de>int8_tde>, de>int16_tde>, de>int32_tde>, or de>int64_tde>, respectively. Note that the definitions shown here are merely representative.
de>SCNdFAST8de>,
de>SCNdFAST16de>,
de>SCNdFAST32de>,
de>SCNdFAST64de> #define
SCNdFAST8 "hhd"
#define
SCNdFAST16 "hd"
#define
SCNdFAST32 "ld"
#define
SCNdFAST64 "lld"
The macros each expand to a string literal suitable for use as a de>dde> scan conversion specificier, plus any needed qualifiers, to convert values of the types de>int_fast8_tde>, de>int_fast16_tde>, de>int_fast32_tde>, or de>int_fast64_tde>, respectively. Note that the definitions shown here are merely representative.
de>SCNdLEAST8de>,
de>SCNdLEAST16de>,
de>SCNdLEAST32de>,
de>SCNdLEAST64de> #define
SCNdLEAST8 "hhd"
#define
SCNdLEAST16 "hd"
#define
SCNdLEAST32 "ld"
#define
SCNdLEAST64 "lld"
The macros each expand to a string literal suitable for use as a de>dde> scan conversion specificier, plus any needed qualifiers, to convert values of the types de>int_least8_tde>, de>int_least16_tde>, de>int_least32_tde>, or de>int_least64_tde>, respectively. Note that the definitions shown here are merely representative.
de>SCNdMAXde> #define
SCNdMAX "lld"
The macro expands to a string literal suitable for use as a de>dde> scan conversion specificier, plus any needed qualifiers, to convert values of the types de>intmax_tde>. Note that the definition shown here is merely representative.
de>SCNdPTRde> #define
SCNdPTR "lld"
The macro expands to a string literal suitable for use as a de>dde> scan conversion specificier, plus any needed qualifiers, to convert values of the types de>intptr_tde>. Note that the definition shown here is merely representative.
de>SCNi8de>,
de>SCNi16de>,
de>SCNi32de>,
de>SCNi64de> #define
SCNi8 "hhi"
#define
SCNi16 "hi"
#define
SCNi32 "li"
#define
SCNi64 "lli"
The macros each expand to a string literal suitable for use as an de>ide> scan conversion specificier, plus any needed qualifiers, to convert values of the types de>int8_tde>, de>int16_tde>, de>int32_tde>, or de>int64_tde>, respectively. Note that the definitions shown here are merely representative.
de>SCNiFAST8de>,
de>SCNiFAST16de>,
de>SCNiFAST32de>,
de>SCNiFAST64de> #define
SCNiFAST8 "hhi"
#define
SCNiFAST16 "hi"
#define
SCNiFAST32 "li"
#define
SCNiFAST64 "lli"
The macros each expand to a string literal suitable for use as an de>ide> scan conversion specificier, plus any needed qualifiers, to convert values of the types de>int_fast8_tde>, de>int_fast16_tde>, de>int_fast32_tde>, or de>int_fast64_tde>, respectively. Note that the definitions shown here are merely representative.
de>SCNiLEAST8de>,
de>SCNiLEAST16de>,
de>SCNiLEAST32de>,
de>SCNiLEAST64de> #define
SCNiLEAST8 "hhi"
#define
SCNiLEAST16 "hi"
#define
SCNiLEAST32 "li"
#define
SCNiLEAST64 "lli"
The macros each expand to a string literal suitable for use as an de>ide> scan conversion specificier, plus any needed qualifiers, to convert values of the types de>int_least8_tde>, de>int_least16_tde>, de>int_least32_tde>, or de>int_least64_tde>, respectively. Note that the definitions shown here are merely representative.
de>SCNiMAXde> #define
SCNiMAX "lli"
The macro expands to a string literal suitable for use as an de>ide> scan conversion specificier, plus any needed qualifiers, to convert values of the types de>intmax_tde>. Note that the definition shown here is merely representative.
de>SCNiPTRde> #define
SCNiPTR "lli"
The macro expands to a string literal suitable for use as an de>ide> scan conversion specificier, plus any needed qualifiers, to convert values of the types de>intptr_tde>. Note that the definition shown here is merely representative.
de>SCNo8de>,
de>SCNo16de>,
de>SCNo32de>,
de>SCNo64de> #define
SCNo8 "hho"
#define
SCNo16 "ho"
#define
SCNo32 "lo"
#define
SCNo64 "llo"
The macros each expand to a string literal suitable for use as an de>ode> scan conversion specificier, plus any needed qualifiers, to convert values of the types de>uint8_tde>, de>uint16_tde>, de>uint32_tde>, or de>uint64_tde>, respectively. Note that the definitions shown here are merely representative.
de>SCNoFAST8de>,
de>SCNoFAST16de>,
de>SCNoFAST32de>,
de>SCNoFAST64de> #define
SCNoFAST8 "hho"
#define
SCNoFAST16 "ho"
#define
SCNoFAST32 "lo"
#define
SCNoFAST64 "llo"
The macros each expand to a string literal suitable for use as an de>ode> scan conversion specificier, plus any needed qualifiers, to convert values of the types de>uint_fast8_tde>, de>uint_fast16_tde>, de>uint_fast32_tde>, or de>uint_fast64_tde>, respectively. Note that the definitions shown here are merely representative.
de>SCNoLEAST8de>,
de>SCNoLEAST16de>,
de>SCNoLEAST32de>,
de>SCNoLEAST64de> #define
SCNoLEAST8 "hho"
#define
SCNoLEAST16 "ho"
#define
SCNoLEAST32 "lo"
#define
SCNoLEAST64 "llo"
The macros each expand to a string literal suitable for use as an de>ode> scan conversion specificier, plus any needed qualifiers, to convert values of the types de>uint_least8_tde>, de>uint_least16_tde>, de>uint_least32_tde>, or de>uint_least64_tde>, respectively. Note that the definitions shown here are merely representative.
de>SCNoMAXde> #define
SCNoMAX "llo"
The macro expands to a string literal suitable for use as an de>ode> scan conversion specificier, plus any needed qualifiers, to convert values of the types de>uintmax_tde>. Note that the definition shown here is merely representative.
de>SCNoPTRde> #define
SCNoPTR "llo"
The macro expands to a string literal suitable for use as an de>ode> scan conversion specificier, plus any needed qualifiers, to convert values of the types de>uintptr_tde>. Note that the definition shown here is merely representative.
de>SCNu8de>,
de>SCNu16de>,
de>SCNu32de>,
de>SCNu64de> #define
SCNu8 "hhu"
#define
SCNu16 "hu"
#define
SCNu32 "lu"
#define
SCNu64 "llu"
The macros each expand to a string literal suitable for use as a de>ude> scan conversion specificier, plus any needed qualifiers, to convert values of the types de>uint8_tde>, de>uint16_tde>, de>uint32_tde>, or de>uint64_tde>, respectively. Note that the definitions shown here are merely representative.
de>SCNuFAST8de>,
de>SCNuFAST16de>,
de>SCNuFAST32de>,
de>SCNuFAST64de> #define
SCNuFAST8 "hhu"
#define
SCNuFAST16 "hu"
#define
SCNuFAST32 "lu"
#define
SCNuFAST64 "llu"
The macros each expand to a string literal suitable for use as a de>ude> scan conversion specificier, plus any needed qualifiers, to convert values of the types de>uint_fast8_tde>, de>uint_fast16_tde>, de>uint_fast32_tde>, or de>uint_fast64_tde>, respectively. Note that the definitions shown here are merely representative.
de>SCNuLEAST8de>,
de>SCNuLEAST16de>,
de>SCNuLEAST32de>,
de>SCNuLEAST64de> #define
SCNuLEAST8 "hhu"
#define
SCNuLEAST16 "hu"
#define
SCNuLEAST32 "lu"
#define
SCNuLEAST64 "llu"
The macros each expand to a string literal suitable for use as a de>ude> scan conversion specificier, plus any needed qualifiers, to convert values of the types de>uint_least8_tde>, de>uint_least16_tde>, de>uint_least32_tde>, or de>uint_least64_tde>, respectively. Note that the definitions shown here are merely representative.
de>SCNuMAXde> #define
SCNuMAX "llu"
The macro expands to a string literal suitable for use as a de>ude> scan conversion specificier, plus any needed qualifiers, to convert values of the types de>uintmax_tde>. Note that the definition shown here is merely representative.
de>SCNuPTRde> #define
SCNuPTR "llu"
The macro expands to a string literal suitable for use as a de>ude> scan conversion specificier, plus any needed qualifiers, to convert values of the types de>uintptr_tde>. Note that the definition shown here is merely representative.
de>SCNx8de>,
de>SCNx16de>,
de>SCNx32de>,
de>SCNx64de> #define
SCNx8 "hhx"
#define
SCNx16 "hx"
#define
SCNx32 "lx"
#define
SCNx64 "llx"
The macros each expand to a string literal suitable for use as an de>xde> scan conversion specificier, plus any needed qualifiers, to convert values of the types de>uint8_tde>, de>uint16_tde>, de>uint32_tde>, or de>uint64_tde>, respectively. Note that the definitions shown here are merely representative.
de>SCNxFAST8de>,
de>SCNxFAST16de>,
de>SCNxFAST32de>,
de>SCNxFAST64de> #define
SCNxFAST8 "hhx"
#define
SCNxFAST16 "hx"
#define
SCNxFAST32 "lx"
#define
SCNxFAST64 "llx"
The macros each expand to a string literal suitable for use as an de>xde> scan conversion specificier, plus any needed qualifiers, to convert values of the types de>uint_fast8_tde>, de>uint_fast16_tde>, de>uint_fast32_tde>, or de>uint_fast64_tde>, respectively. Note that the definitions shown here are merely representative.
de>SCNxLEAST8de>,
de>SCNxLEAST16de>,
de>SCNxLEAST32de>,
de>SCNxLEAST64de> #define
SCNxLEAST8 "hhx"
#define
SCNxLEAST16 "hx"
#define
SCNxLEAST32 "lx"
#define
SCNxLEAST64 "llx"
The macros each expand to a string literal suitable for use as an de>xde> scan conversion specificier, plus any needed qualifiers, to convert values of the types de>uint_least8_tde>, de>uint_least16_tde>, de>uint_least32_tde>, or de>uint_least64_tde>, respectively. Note that the definitions shown here are merely representative.
de>SCNxMAXde> #define
SCNxMAX "llx"
The macro expands to a string literal suitable for use as an de>xde> scan conversion specificier, plus any needed qualifiers, to convert values of the types de>uintmax_tde>. Note that the definition shown here is merely representative.
de>SCNxPTRde> #define
SCNxPTR "llx"
The macro expands to a string literal suitable for use as an de>xde> scan conversion specificier, plus any needed qualifiers, to convert values of the types de>uintptr_tde>. Note that the definition shown here is merely representative.
de>strtoimaxde> intmax_t
strtoimax(const char *restrict s, char **restrict endptr,
int base);
The function converts the initial characters of the string de>sde> to an equivalent value de>xde> of type intmax_t. If de>endptrde> is not a null pointer, it stores a pointer to the unconverted remainder of the string in de>*endptrde>. The function then returns de>xde>. de>strtoimaxde> converts strings exactly as does de>strtolde>.
If the string de>sde> does not match a valid pattern, the value stored in de>*endptrde> is de>sde>, and de>xde> is zero. If the equivalent value is too large to represent as type intmax_t, de>strtoimaxde> stores the value of de>ERANGEde> in de>errnode> and returns either de>INTMAX_MAXde>, if de>xde> is positive, or de>INTMAX_MINde>, if de>xde> is negative.
de>strtoumaxde> uintmax_t
strtoumax(const char *restrict s, char **restrict endptr,
int base);
The function converts the initial characters of the string de>sde> to an equivalent value de>xde> of type uintmax_t. If de>endptrde> is not a null pointer, it stores a pointer to the unconverted remainder of the string in de>*endptrde>. The function then returns de>xde>. de>strtoumaxde> converts strings exactly as does de>strtoulde>.
If the string de>sde> does not match a valid pattern, the value stored in de>*endptrde> is de>sde>, and de>xde> is zero. If the equivalent value is too large to represent as type uintmax_t, de>strtoumaxde> stores the value of de>ERANGEde> in de>errnode> and returns de>UINTMAX_MAXde>.
de>wcstoimaxde> intmax_t
wcstimax(const wchar_t *restrict s, wchar_t **restrict endptr,
int base);
The function converts the initial wide characters of the wide string de>sde> to an equivalent value de>xde> of type intmax_t. If de>endptrde> is not a null pointer, the function stores a pointer to the unconverted remainder of the wide string in de>*endptrde>. The function then returns de>xde>.
The initial wide characters of the wide string de>sde> must match the same pattern as recognized by the function de>strtolde>, with the same de>basede> argument, where each wide character de>wcde> is converted as if by calling de>wctob(wc))de>.
If the wide string de>sde> matches this pattern, de>wcstoimaxde> converts strings exactly as does de>strtolde>, with the same de>basede> argument, for the converted sequence. If the wide string de>sde> does not match a valid pattern, the value stored in de>*endptrde> is de>sde>, and de>xde> is zero. If the equivalent value is too large in magnitude to represent as type intmax_t, de>wcstoimaxde> stores the value of de>ERANGEde> in de>errnode> and returns either de>INTMAX_MAXde>, if de>xde> is positive, or de>INTMAX_MINde>, if de>xde> is negative.
de>wcstoumaxde> uintmax_t
wcstoumax(const wchar_t *restrict s,
wchar_t **restrict endptr, int base);
The function converts the initial wide characters of the wide string de>sde> to an equivalent value de>xde> of type uintmax_t. If de>endptrde> is not a null pointer, the function stores a pointer to the unconverted remainder of the wide string in de>*endptrde>. The function then returns de>xde>.
The initial wide characters of the wide string de>sde> must match the same pattern as recognized by the function de>strtolde>, with the same de>basede> argument, where each wide character de>wcde> is converted as if by calling de>wctob(wc))de>.
If the wide string de>sde> matches this pattern, de>wcstoumaxde> converts strings exactly as does de>strtolde>, with the same de>basede> argument, for the converted sequence. If the wide string de>sde> does not match a valid pattern, the value stored in de>*endptrde> is de>sde>, and de>xde> is zero. If the equivalent value is too large to represent as type uintmax_t, de>wcstoimaxde> stores the value of de>ERANGEde> in de>errnode> and returns de>UINTMAX_MAXde>.
See also the Table of Contents and the Index.
Copyright ? 1992-2006 by P.J. Plauger. All rights reserved.