INTTYPES(3)
π NAME π
inttypes(3) from the Library Functions Manual β standard fixed-size integer types, bestie. This is your lil guide to the header that makes fixed-size integer formatting portable and cute. π
β¨ SYNOPSIS β¨
#include <inttypes.h>
π¦ DESCRIPTION π¦
Okay so, the <inttypes.h> header describes a set of format specifier macros. Their whole mission? Increase portability both within and across operating systems. It includes the <stdint.h> header and extends it with additional facilities. Slay.
Each of the following macros expands to a character string literal containing the format specifier suitable for use within the format argument of a formatted I/O function such as printf(3). Each macro contains an identifier (PRI or SCN), a conversion specifier, and a possible length modifier. No cap.
The length modifier follows the integer types described in stdint(3):
int8_t/uint8_tint16_t/uint16_tint32_t/uint32_tint64_t/uint64_tint_least8_t/uint_least8_tint_least16_t/uint_least16_tint_least32_t/uint_least32_tint_least64_t/uint_least64_tint_fast8_t/uint_fast8_tint_fast16_t/uint_fast16_tint_fast32_t/uint_fast32_tint_fast64_t/uint_fast64_tintmax_t/uintmax_tintptr_t/uintptr_t
The following format specifiers are defined for the fprintf(3) and fscanf(3) families, respectively:
PRI?8/SCN?8PRI?16/SCN?16PRI?32/SCN?32PRI?64/SCN?64PRI?LEAST8/SCN?LEAST8PRI?LEAST16/SCN?LEAST16PRI?LEAST32/SCN?LEAST32PRI?LEAST64/SCN?LEAST64PRI?FAST8/SCN?FAST8PRI?FAST16/SCN?FAST16PRI?FAST32/SCN?FAST32PRI?FAST64/SCN?FAST64PRI?MAX/SCN?MAXPRI?PTR/SCN?PTR
The available conversion specifiers β the β?β in above β are d and i for signed integers and o, u, x, and X for unsigned integers. The X is not available for the fscanf(3) family. Without the length modifier these would correspond with %d, %i, %o, %u, %x, and %X, respectively. π«Ά
π EXAMPLES π
The following example demonstrates typical usage:
uint64_t i = 123;
...
(void)printf("i = %"PRIu64"\n", i);
π SEE ALSO π
printf(3), scanf(3), stdint(3)
π STANDARDS π
The <inttypes.h> header conforms to ISO/IEC 9899:1999 (βISO C99β) and IEEE Std 1003.1-2001 (βPOSIX.1β).
π HISTORY π
The <inttypes.h> header was first introduced in NetBSD 1.6.
π Source/version: Debian Β· date: March 21, 2010 Β· page: INTTYPES(3) β bye bestie, you ate! π
π¦ where this page comes from
- nixpkgs unstable: netbsd-source 11.0
- Copyright (c) 2010 The NetBSD Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms