Standard library header <cinttypes> - cppreference.com

##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# Standard library header <cinttypes>

From cppreference.com
< cpp‎ | header

This header was originally in the C standard library as `<inttypes.h>`.

Provides conversions from C byte and wide strings to std::intmax_t and std::uintmax_t, overloads some math functions for std::intmax_t and provide C style input/output format macros for the types declared in `<cstdint>`.

### [edit] Includes

`<cstdint>`

### [edit] Types

imaxdiv_t (C++11) | structure type, return of the std::imaxdiv function (typedef) [edit]

### [edit] Functions

abs(std::intmax_t)imaxabs (C++11)(C++11) | computes absolute value of an integral value (|x|) (function) [edit]
div(std::intmax_t)imaxdiv (C++11)(C++11) | computes quotient and remainder of integer division (function) [edit]
strtoimaxstrtoumax (C++11)(C++11) | converts a byte string to std::intmax_t or std::uintmax_t (function) [edit]
wcstoimaxwcstoumax (C++11)(C++11) | converts a wide string to std::intmax_t or std::uintmax_t (function) [edit]

### [edit] Macros

##### Format constants for the std::fprintf family of functions
PRId8 PRId16 PRId32 PRId64 PRIdLEAST8 PRIdLEAST16 PRIdLEAST32 PRIdLEAST64 PRIdFAST8 PRIdFAST16 PRIdFAST32 PRIdFAST64 PRIdMAX PRIdPTR | format conversion specifier to output a signed decimal integer value of type std::int8_t, std::int16_t, std::int32_t, std::int64_t, std::int_least8_t, std::int_least16_t, std::int_least32_t, std::int_least64_t, std::int_fast8_t, std::int_fast16_t, std::int_fast32_t, std::int_fast64_t, std:intmax_t, std::intptr_t respectively, equivalent to `%d` for int (macro constant)
PRIi8 PRIi16 PRIi32 PRIi64 PRIiLEAST8 PRIiLEAST16 PRIiLEAST32 PRIiLEAST64 PRIiFAST8 PRIiFAST16 PRIiFAST32 PRIiFAST64 PRIiMAX PRIiPTR | format conversion specifier to output a signed decimal integer value of type std::int8_t, std::int16_t, std::int32_t, std::int64_t, std::int_least8_t, std::int_least16_t, std::int_least32_t, std::int_least64_t, std::int_fast8_t, std::int_fast16_t, std::int_fast32_t, std::int_fast64_t, std:intmax_t, std::intptr_t respectively, equivalent to `%i` for int (macro constant)
PRIu8 PRIu16 PRIu32 PRIu64 PRIuLEAST8 PRIuLEAST16 PRIuLEAST32 PRIuLEAST64 PRIuFAST8 PRIuFAST16 PRIuFAST32 PRIuFAST64 PRIuMAX PRIuPTR | format conversion specifier to output an unsigned decimal integer value of type std::uint8_t, std::uint16_t, std::uint32_t, std::uint64_t, std::uint_least8_t, std::uint_least16_t, std::uint_least32_t, std::uint_least64_t, std::uint_fast8_t, std::uint_fast16_t, std::uint_fast32_t, std::uint_fast64_t, std:uintmax_t, std::uintptr_t respectively, equivalent to `%u` for unsigned int (macro constant)
PRIo8 PRIo16 PRIo32 PRIo64 PRIoLEAST8 PRIoLEAST16 PRIoLEAST32 PRIoLEAST64 PRIoFAST8 PRIoFAST16 PRIoFAST32 PRIoFAST64 PRIoMAX PRIoPTR | format conversion specifier to output an unsigned octal integer value of type std::uint8_t, std::uint16_t, std::uint32_t, std::uint64_t, std::uint_least8_t, std::uint_least16_t, std::uint_least32_t, std::uint_least64_t, std::uint_fast8_t, std::uint_fast16_t, std::uint_fast32_t, std::uint_fast64_t, std:uintmax_t, std::uintptr_t respectively, equivalent to `%o` for unsigned int (macro constant)
PRIx8 PRIx16 PRIx32 PRIx64 PRIxLEAST8 PRIxLEAST16 PRIxLEAST32 PRIxLEAST64 PRIxFAST8 PRIxFAST16 PRIxFAST32 PRIxFAST64 PRIxMAX PRIxPTR | format conversion specifier to output an unsigned hexadecimal integer value of type std::uint8_t, std::uint16_t, std::uint32_t, std::uint64_t, std::uint_least8_t, std::uint_least16_t, std::uint_least32_t, std::uint_least64_t, std::uint_fast8_t, std::uint_fast16_t, std::uint_fast32_t, std::uint_fast64_t, std:uintmax_t, std::uintptr_t respectively, equivalent to `%x` for unsigned int (macro constant)
PRIX8 PRIX16 PRIX32 PRIX64 PRIXLEAST8 PRIXLEAST16 PRIXLEAST32 PRIXLEAST64 PRIXFAST8 PRIXFAST16 PRIXFAST32 PRIXFAST64 PRIXMAX PRIXPTR | format conversion specifier to output an unsigned uppercase hexadecimal integer value of type std::uint8_t, std::uint16_t, std::uint32_t, std::uint64_t, std::uint_least8_t, std::uint_least16_t, std::uint_least32_t, std::uint_least64_t, std::uint_fast8_t, std::uint_fast16_t, std::uint_fast32_t, std::uint_fast64_t, std:uintmax_t, std::uintptr_t respectively, equivalent to `%X` for unsigned int (macro constant)
##### Format constants for the std::fscanf family of functions
SCNd8 SCNd16 SCNd32 SCNd64 SCNdLEAST8 SCNdLEAST16 SCNdLEAST32 SCNdLEAST64 SCNdFAST8 SCNdFAST16 SCNdFAST32 SCNdFAST64 SCNdMAX SCNdPTR | format conversion specifier to input a signed decimal integer value of type std::int8_t, std::int16_t, std::int32_t, std::int64_t, std::int_least8_t, std::int_least16_t, std::int_least32_t, std::int_least64_t, std::int_fast8_t, std::int_fast16_t, std::int_fast32_t, std::int_fast64_t, std:intmax_t, std::intptr_t respectively, equivalent to `%d` for int (macro constant)
SCNi8 SCNi16 SCNi32 SCNi64 SCNiLEAST8 SCNiLEAST16 SCNiLEAST32 SCNiLEAST64 SCNiFAST8 SCNiFAST16 SCNiFAST32 SCNiFAST64 SCNiMAX SCNiPTR | format conversion specifier to input a signed decimal/octal/hexadecimal integer value of type std::int8_t, std::int16_t, std::int32_t, std::int64_t, std::int_least8_t, std::int_least16_t, std::int_least32_t, std::int_least64_t, std::int_fast8_t, std::int_fast16_t, std::int_fast32_t, std::int_fast64_t, std:intmax_t, std::intptr_t respectively, equivalent to `%i` for int (macro constant)
SCNu8 SCNu16 SCNu32 SCNu64 SCNuLEAST8 SCNuLEAST16 SCNuLEAST32 SCNuLEAST64 SCNuFAST8 SCNuFAST16 SCNuFAST32 SCNuFAST64 SCNuMAX SCNuPTR | format conversion specifier to input an unsigned decimal integer value of type std::uint8_t, std::uint16_t, std::uint32_t, std::uint64_t, std::uint_least8_t, std::uint_least16_t, std::uint_least32_t, std::uint_least64_t, std::uint_fast8_t, std::uint_fast16_t, std::uint_fast32_t, std::uint_fast64_t, std:uintmax_t, std::uintptr_t respectively, equivalent to `%u` for unsigned int (macro constant)
SCNo8 SCNo16 SCNo32 SCNo64 SCNoLEAST8 SCNoLEAST16 SCNoLEAST32 SCNoLEAST64 SCNoFAST8 SCNoFAST16 SCNoFAST32 SCNoFAST64 SCNoMAX SCNoPTR | format conversion specifier to input an unsigned octal integer value of type std::uint8_t, std::uint16_t, std::uint32_t, std::uint64_t, std::uint_least8_t, std::uint_least16_t, std::uint_least32_t, std::uint_least64_t, std::uint_fast8_t, std::uint_fast16_t, std::uint_fast32_t, std::uint_fast64_t, std:uintmax_t, std::uintptr_t respectively, equivalent to `%o` for unsigned int (macro constant)
SCNx8 SCNx16 SCNx32 SCNx64 SCNxLEAST8 SCNxLEAST16 SCNxLEAST32 SCNxLEAST64 SCNxFAST8 SCNxFAST16 SCNxFAST32 SCNxFAST64 SCNxMAX SCNxPTR | format conversion specifier to input an unsigned hexadecimal integer value of type std::uint8_t, std::uint16_t, std::uint32_t, std::uint64_t, std::uint_least8_t, std::uint_least16_t, std::uint_least32_t, std::uint_least64_t, std::uint_fast8_t, std::uint_fast16_t, std::uint_fast32_t, std::uint_fast64_t, std:uintmax_t, std::uintptr_t respectively, equivalent to `%x` for unsigned int (macro constant)
SCNX8 SCNX16 SCNX32 SCNX64 SCNXLEAST8 SCNXLEAST16 SCNXLEAST32 SCNXLEAST64 SCNXFAST8 SCNXFAST16 SCNXFAST32 SCNXFAST64 SCNXMAX SCNXPTR | format conversion specifier to input an unsigned uppercase hexadecimal integer value of type std::uint8_t, std::uint16_t, std::uint32_t, std::uint64_t, std::uint_least8_t, std::uint_least16_t, std::uint_least32_t, std::uint_least64_t, std::uint_fast8_t, std::uint_fast16_t, std::uint_fast32_t, std::uint_fast64_t, std:uintmax_t, std::uintptr_t respectively, equivalent to `%X` for unsigned int (macro constant)

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/header/cinttypes&oldid=71908"