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
PRId8PRId16PRId32PRId64PRIdLEAST8PRIdLEAST16PRIdLEAST32PRIdLEAST64PRIdFAST8PRIdFAST16PRIdFAST32PRIdFAST64PRIdMAXPRIdPTR | 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)
PRIi8PRIi16PRIi32PRIi64PRIiLEAST8PRIiLEAST16PRIiLEAST32PRIiLEAST64PRIiFAST8PRIiFAST16PRIiFAST32PRIiFAST64PRIiMAXPRIiPTR | 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)
PRIu8PRIu16PRIu32PRIu64PRIuLEAST8PRIuLEAST16PRIuLEAST32PRIuLEAST64PRIuFAST8PRIuFAST16PRIuFAST32PRIuFAST64PRIuMAXPRIuPTR | 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)
PRIo8PRIo16PRIo32PRIo64PRIoLEAST8PRIoLEAST16PRIoLEAST32PRIoLEAST64PRIoFAST8PRIoFAST16PRIoFAST32PRIoFAST64PRIoMAXPRIoPTR | 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)
PRIx8PRIx16PRIx32PRIx64PRIxLEAST8PRIxLEAST16PRIxLEAST32PRIxLEAST64PRIxFAST8PRIxFAST16PRIxFAST32PRIxFAST64PRIxMAXPRIxPTR | 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)
PRIX8PRIX16PRIX32PRIX64PRIXLEAST8PRIXLEAST16PRIXLEAST32PRIXLEAST64PRIXFAST8PRIXFAST16PRIXFAST32PRIXFAST64PRIXMAXPRIXPTR | 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
SCNd8SCNd16SCNd32SCNd64SCNdLEAST8SCNdLEAST16SCNdLEAST32SCNdLEAST64SCNdFAST8SCNdFAST16SCNdFAST32SCNdFAST64SCNdMAXSCNdPTR | 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)
SCNi8SCNi16SCNi32SCNi64SCNiLEAST8SCNiLEAST16SCNiLEAST32SCNiLEAST64SCNiFAST8SCNiFAST16SCNiFAST32SCNiFAST64SCNiMAXSCNiPTR | 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)
SCNu8SCNu16SCNu32SCNu64SCNuLEAST8SCNuLEAST16SCNuLEAST32SCNuLEAST64SCNuFAST8SCNuFAST16SCNuFAST32SCNuFAST64SCNuMAXSCNuPTR | 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)
SCNo8SCNo16SCNo32SCNo64SCNoLEAST8SCNoLEAST16SCNoLEAST32SCNoLEAST64SCNoFAST8SCNoFAST16SCNoFAST32SCNoFAST64SCNoMAXSCNoPTR | 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)
SCNx8SCNx16SCNx32SCNx64SCNxLEAST8SCNxLEAST16SCNxLEAST32SCNxLEAST64SCNxFAST8SCNxFAST16SCNxFAST32SCNxFAST64SCNxMAXSCNxPTR | 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)
SCNX8SCNX16SCNX32SCNX64SCNXLEAST8SCNXLEAST16SCNXLEAST32SCNXLEAST64SCNXFAST8SCNXFAST16SCNXFAST32SCNXFAST64SCNXMAXSCNXPTR | 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=76420"