Namespaces
Variants

Standard library header <cinttypes> (C++11)

From cppreference.com
 
 
Standard library headers
 

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

Includes

(C++11)
Fixed-width integer types and limits of other types[edit]

Types

(C++11)
structure type, returned by std::imaxdiv
(typedef) [edit]

Functions

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

Macros

Format constants for the std::fprintf family of functions
PRIdNPRIdLEASTNPRIdFASTNPRIdMAXPRIdPTR
(C++11)
format conversion specifier to output a signed decimal integer value of type std::intN_t, std::int_leastN_t, std::int_fastN_t, std::intmax_t, std::intptr_t respectively, equivalent to d for int
(macro constant)
PRIiNPRIiLEASTNPRIiFASTNPRIiMAXPRIiPTR
(C++11)
format conversion specifier to output a signed decimal integer value of type std::intN_t, std::int_leastN_t, std::int_fastN_t, std::intmax_t, std::intptr_t respectively, equivalent to i for int
(macro constant)
PRIuNPRIuLEASTNPRIuFASTNPRIuMAXPRIuPTR
(C++11)
format conversion specifier to output an unsigned decimal integer value of type std::uintN_t, std::uint_leastN_t, std::uint_fastN_t, std::uintmax_t, std::uintptr_t respectively, equivalent to u for unsigned int
(macro constant)
PRIoNPRIoLEASTNPRIoFASTNPRIoMAXPRIoPTR
(C++11)
format conversion specifier to output an unsigned octal integer value of type std::uintN_t, std::uint_leastN_t, std::uint_fastN_t, std::uintmax_t, std::uintptr_t respectively, equivalent to o for unsigned int
(macro constant)
PRIxNPRIxLEASTNPRIxFASTNPRIxMAXPRIxPTR
(C++11)
format conversion specifier to output an unsigned lowercase hexadecimal integer value of type std::uintN_t, std::uint_leastN_t, std::uint_fastN_t, std::uintmax_t, std::uintptr_t respectively, equivalent to x for unsigned int
(macro constant)
PRIXNPRIXLEASTNPRIXFASTNPRIXMAXPRIXPTR
(C++11)
format conversion specifier to output an unsigned uppercase hexadecimal integer value of type std::uintN_t, std::uint_leastN_t, std::uint_fastN_t, std::uintmax_t, std::uintptr_t respectively, equivalent to X for unsigned int
(macro constant)
PRIbNPRIbLEASTNPRIbFASTNPRIbMAXPRIbPTR
(C++26)
format conversion specifier to output an unsigned lowercase binary integer value of type std::uintN_t, std::uint_leastN_t, std::uint_fastN_t, std::uintmax_t, std::uintptr_t respectively, equivalent to b for unsigned int
(macro constant)
PRIBNPRIBLEASTNPRIBFASTNPRIBMAXPRIBPTR
(C++26)(conditionally present)
format conversion specifier to output an unsigned uppercase binary integer value of type std::uintN_t, std::uint_leastN_t, std::uint_fastN_t, std::uintmax_t, std::uintptr_t respectively, equivalent to B for unsigned int
(defined if and only std::fprintf supports the B conversion specifier)
(macro constant)
Format constants for the std::fscanf family of functions
SCNdNSCNdNSCNdNSCNdMAXSCNdPTR
(C++11)
format conversion specifier to input a signed decimal integer value of type std::intN_t, std::int_leastN_t, std::int_fastN_t, std::intmax_t, std::intptr_t respectively, equivalent to d for int
(macro constant)
SCNiNSCNiNSCNiNSCNiMAXSCNiPTR
(C++11)
format conversion specifier to input a signed decimal/octal/hexadecimal integer value of type std::intN_t, std::int_leastN_t, std::int_fastN_t, std::intmax_t, std::intptr_t respectively, equivalent to i for int
(macro constant)
SCNuNSCNuNSCNuNSCNuMAXSCNuPTR
(C++11)
format conversion specifier to input an unsigned decimal integer value of type std::uintN_t, std::uint_leastN_t, std::uint_fastN_t, std::uintmax_t, std::uintptr_t respectively, equivalent to u for unsigned int
(macro constant)
SCNoNSCNoNSCNoNSCNoMAXSCNoPTR
(C++11)
format conversion specifier to input an unsigned octal integer value of type std::uintN_t, std::uint_leastN_t, std::uint_fastN_t, std::uintmax_t, std::uintptr_t respectively, equivalent to o for unsigned int
(macro constant)
SCNxNSCNxNSCNxNSCNxMAXSCNxPTR
(C++11)
format conversion specifier to input an unsigned hexadecimal integer value of type std::uintN_t, std::uint_leastN_t, std::uint_fastN_t, std::uintmax_t, std::uintptr_t respectively, equivalent to x for unsigned int
(macro constant)
SCNbNSCNbNSCNbNSCNbMAXSCNbPTR
(C++26)
format conversion specifier to input an unsigned binary integer value of type std::uintN_t, std::uint_leastN_t, std::uint_fastN_t, std::uintmax_t, std::uintptr_t respectively, equivalent to b for unsigned int
(macro constant)

Synopsis

#include <cstdint>

#define __STDC_VERSION_INTTYPES_H__ 202311L

namespace std
{
    using imaxdiv_t = /* see description */;

    constexpr intmax_t imaxabs(intmax_t j);
    constexpr imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom);
    intmax_t strtoimax(const char* nptr, char** endptr, int base);
    uintmax_t strtoumax(const char* nptr, char** endptr, int base);
    intmax_t wcstoimax(const wchar_t* nptr, wchar_t** endptr, int base);
    uintmax_t wcstoumax(const wchar_t* nptr, wchar_t** endptr, int base);

    constexpr intmax_t abs(intmax_t);            // optional, see description
    constexpr imaxdiv_t div(intmax_t, intmax_t); // optional, see description
}

#define PRIdN /* see description */
#define PRIiN /* see description */
#define PRIoN /* see description */
#define PRIuN /* see description */
#define PRIxN /* see description */
#define PRIXN /* see description */
#define PRIbN /* see description */
#define PRIBN /* see description */
#define SCNdN /* see description */
#define SCNiN /* see description */
#define SCNoN /* see description */
#define SCNuN /* see description */
#define SCNxN /* see description */
#define SCNbN /* see description */
#define PRIdLEASTN /* see description */
#define PRIiLEASTN /* see description */
#define PRIoLEASTN /* see description */
#define PRIuLEASTN /* see description */
#define PRIxLEASTN /* see description */
#define PRIXLEASTN /* see description */
#define PRIbLEASTN /* see description */
#define PRIBLEASTN /* see description */
#define SCNdLEASTN /* see description */
#define SCNiLEASTN /* see description */
#define SCNoLEASTN /* see description */
#define SCNuLEASTN /* see description */
#define SCNxLEASTN /* see description */
#define SCNbLEASTN /* see description */
#define PRIdFASTN /* see description */
#define PRIiFASTN /* see description */
#define PRIoFASTN /* see description */
#define PRIuFASTN /* see description */
#define PRIxFASTN /* see description */
#define PRIXFASTN /* see description */
#define PRIbFASTN /* see description */
#define PRIBFASTN /* see description */
#define SCNdFASTN /* see description */
#define SCNiFASTN /* see description */
#define SCNoFASTN /* see description */
#define SCNuFASTN /* see description */
#define SCNxFASTN /* see description */
#define SCNbFASTN /* see description */
#define PRIdMAX /* see description */
#define PRIiMAX /* see description */
#define PRIoMAX /* see description */
#define PRIuMAX /* see description */
#define PRIxMAX /* see description */
#define PRIXMAX /* see description */
#define PRIbMAX /* see description */
#define PRIBMAX /* see description */
#define SCNdMAX /* see description */
#define SCNiMAX /* see description */
#define SCNoMAX /* see description */
#define SCNuMAX /* see description */
#define SCNxMAX /* see description */
#define SCNbMAX /* see description */
#define PRIdPTR /* see description */
#define PRIiPTR /* see description */
#define PRIoPTR /* see description */
#define PRIuPTR /* see description */
#define PRIxPTR /* see description */
#define PRIXPTR /* see description */
#define PRIbPTR /* see description */
#define PRIBPTR /* see description */
#define SCNdPTR /* see description */
#define SCNiPTR /* see description */
#define SCNoPTR /* see description */
#define SCNuPTR /* see description */
#define SCNxPTR /* see description */
#define SCNbPTR /* see description */