Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/header/cinttypes"

From cppreference.com
< cpp‎ | header
m
m (fmt)
 
(11 intermediate revisions by 9 users not shown)
Line 1: Line 1:
{{cpp/header/title|cinttypes}}
+
{{cpp/header/title|cinttypes|notes={{mark c++11}}}}
 
{{cpp/header/navbar}}
 
{{cpp/header/navbar}}
 
{{cpp/header/c}}
 
{{cpp/header/c}}
  
Provides conversions from C [[cpp/string/byte|byte]] and [[cpp/string/wide|wide]] strings to {{lc|std::intmax_t}} and {{lc|std::uintmax_t}}, overloads some [[cpp/numeric/math|math functions]] for {{lc|std::intmax_t}} and provide [[cpp/io/c|C style input/output]] format macros for the types declared in {{header|cstdint}}.
 
 
===Includes===
 
 
{{dsc begin}}
 
{{dsc begin}}
{{dsc|{{header|cstdint}}}}
+
{{dsc h1|Includes}}
{{dsc end}}
+
{{dsc inc|cpp/header/dsc cstdint}}
  
===Types===
+
{{dsc h1|Types}}
{{dsc begin}}
+
{{dsc inc|cpp/numeric/math/dsc imaxdiv_t}}
{{dsc inc | cpp/numeric/math/dsc imaxdiv_t}}
+
{{dsc end}}
+
  
===Functions===
+
{{dsc h1|Functions}}
{{dsc begin}}
+
{{dsc inc|cpp/numeric/math/dsc imaxabs}}
{{dsc inc | cpp/numeric/math/dsc imaxabs}}
+
{{dsc inc|cpp/numeric/math/dsc imaxdiv}}
{{dsc inc | cpp/numeric/math/dsc imaxdiv}}
+
{{dsc inc|cpp/string/byte/dsc strtoimax}}
{{dsc inc | cpp/string/byte/dsc strtoimax}}
+
{{dsc inc|cpp/string/wide/dsc wcstoimax}}
{{dsc inc | cpp/string/wide/dsc wcstoimax}}
+
 
 +
{{dsc h1|Macros}}
 +
{{dsc h2|Format constants for the {{lc|std::fprintf}} family of functions}}
 +
{{dsc macro const|PRId8<br>PRId16<br>PRId32<br>PRId64<br>PRIdLEAST8<br>PRIdLEAST16<br>PRIdLEAST32<br>PRIdLEAST64<br>PRIdFAST8<br>PRIdFAST16<br>PRIdFAST32<br>PRIdFAST64<br>PRIdMAX<br>PRIdPTR|notes={{mark c++11}}|format conversion specifier to output a signed decimal integer value of type {{lc|std::int8_t}}, {{lc|std::int16_t}}, {{lc|std::int32_t}}, {{lc|std::int64_t}}, {{lc|std::int_least8_t}}, {{lc|std::int_least16_t}}, {{lc|std::int_least32_t}}, {{lc|std::int_least64_t}}, {{lc|std::int_fast8_t}}, {{lc|std::int_fast16_t}}, {{lc|std::int_fast32_t}}, {{lc|std::int_fast64_t}}, {{lc|std::intmax_t}}, {{lc|std::intptr_t}} respectively, equivalent to {{tt|d}} for {{c/core|int}}|nolink=true}}
 +
{{dsc macro const|PRIi8<br>PRIi16<br>PRIi32<br>PRIi64<br>PRIiLEAST8<br>PRIiLEAST16<br>PRIiLEAST32<br>PRIiLEAST64<br>PRIiFAST8<br>PRIiFAST16<br>PRIiFAST32<br>PRIiFAST64<br>PRIiMAX<br>PRIiPTR|notes={{mark c++11}}|format conversion specifier to output a signed decimal integer value of type {{lc|std::int8_t}}, {{lc|std::int16_t}}, {{lc|std::int32_t}}, {{lc|std::int64_t}}, {{lc|std::int_least8_t}}, {{lc|std::int_least16_t}}, {{lc|std::int_least32_t}}, {{lc|std::int_least64_t}}, {{lc|std::int_fast8_t}}, {{lc|std::int_fast16_t}}, {{lc|std::int_fast32_t}}, {{lc|std::int_fast64_t}}, {{lc|std::intmax_t}}, {{lc|std::intptr_t}} respectively, equivalent to {{tt|i}} for {{c/core|int}}|nolink=true}}
 +
{{dsc macro const|PRIu8<br>PRIu16<br>PRIu32<br>PRIu64<br>PRIuLEAST8<br>PRIuLEAST16<br>PRIuLEAST32<br>PRIuLEAST64<br>PRIuFAST8<br>PRIuFAST16<br>PRIuFAST32<br>PRIuFAST64<br>PRIuMAX<br>PRIuPTR|notes={{mark c++11}}|format conversion specifier to output an unsigned decimal integer value of type {{lc|std::uint8_t}}, {{lc|std::uint16_t}}, {{lc|std::uint32_t}}, {{lc|std::uint64_t}}, {{lc|std::uint_least8_t}}, {{lc|std::uint_least16_t}}, {{lc|std::uint_least32_t}}, {{lc|std::uint_least64_t}}, {{lc|std::uint_fast8_t}}, {{lc|std::uint_fast16_t}}, {{lc|std::uint_fast32_t}}, {{lc|std::uint_fast64_t}}, {{lc|std::uintmax_t}}, {{lc|std::uintptr_t}} respectively, equivalent to {{tt|u}} for {{c/core|unsigned int}}|nolink=true}}
 +
{{dsc macro const|PRIo8<br>PRIo16<br>PRIo32<br>PRIo64<br>PRIoLEAST8<br>PRIoLEAST16<br>PRIoLEAST32<br>PRIoLEAST64<br>PRIoFAST8<br>PRIoFAST16<br>PRIoFAST32<br>PRIoFAST64<br>PRIoMAX<br>PRIoPTR|notes={{mark c++11}}|format conversion specifier to output an unsigned octal integer value of type {{lc|std::uint8_t}}, {{lc|std::uint16_t}}, {{lc|std::uint32_t}}, {{lc|std::uint64_t}}, {{lc|std::uint_least8_t}}, {{lc|std::uint_least16_t}}, {{lc|std::uint_least32_t}}, {{lc|std::uint_least64_t}}, {{lc|std::uint_fast8_t}}, {{lc|std::uint_fast16_t}}, {{lc|std::uint_fast32_t}}, {{lc|std::uint_fast64_t}}, {{lc|std::uintmax_t}}, {{lc|std::uintptr_t}} respectively, equivalent to {{tt|o}} for {{c/core|unsigned int}}|nolink=true}}
 +
{{dsc macro const|PRIx8<br>PRIx16<br>PRIx32<br>PRIx64<br>PRIxLEAST8<br>PRIxLEAST16<br>PRIxLEAST32<br>PRIxLEAST64<br>PRIxFAST8<br>PRIxFAST16<br>PRIxFAST32<br>PRIxFAST64<br>PRIxMAX<br>PRIxPTR|notes={{mark c++11}}|format conversion specifier to output an unsigned lowercase hexadecimal integer value of type {{lc|std::uint8_t}}, {{lc|std::uint16_t}}, {{lc|std::uint32_t}}, {{lc|std::uint64_t}}, {{lc|std::uint_least8_t}}, {{lc|std::uint_least16_t}}, {{lc|std::uint_least32_t}}, {{lc|std::uint_least64_t}}, {{lc|std::uint_fast8_t}}, {{lc|std::uint_fast16_t}}, {{lc|std::uint_fast32_t}}, {{lc|std::uint_fast64_t}}, {{lc|std::uintmax_t}}, {{lc|std::uintptr_t}} respectively, equivalent to {{tt|x}} for {{c/core|unsigned int}}|nolink=true}}
 +
{{dsc macro const|PRIX8<br>PRIX16<br>PRIX32<br>PRIX64<br>PRIXLEAST8<br>PRIXLEAST16<br>PRIXLEAST32<br>PRIXLEAST64<br>PRIXFAST8<br>PRIXFAST16<br>PRIXFAST32<br>PRIXFAST64<br>PRIXMAX<br>PRIXPTR|notes={{mark c++11}}|format conversion specifier to output an unsigned uppercase hexadecimal integer value of type {{lc|std::uint8_t}}, {{lc|std::uint16_t}}, {{lc|std::uint32_t}}, {{lc|std::uint64_t}}, {{lc|std::uint_least8_t}}, {{lc|std::uint_least16_t}}, {{lc|std::uint_least32_t}}, {{lc|std::uint_least64_t}}, {{lc|std::uint_fast8_t}}, {{lc|std::uint_fast16_t}}, {{lc|std::uint_fast32_t}}, {{lc|std::uint_fast64_t}}, {{lc|std::uintmax_t}}, {{lc|std::uintptr_t}} respectively, equivalent to {{tt|X}} for {{c/core|unsigned int}}|nolink=true}}
 +
{{dsc h2|Format constants for the {{lc|std::fscanf}} family of functions}}
 +
{{dsc macro const|SCNd8<br>SCNd16<br>SCNd32<br>SCNd64<br>SCNdLEAST8<br>SCNdLEAST16<br>SCNdLEAST32<br>SCNdLEAST64<br>SCNdFAST8<br>SCNdFAST16<br>SCNdFAST32<br>SCNdFAST64<br>SCNdMAX<br>SCNdPTR|notes={{mark c++11}}|format conversion specifier to input a signed decimal integer value of type {{lc|std::int8_t}}, {{lc|std::int16_t}}, {{lc|std::int32_t}}, {{lc|std::int64_t}}, {{lc|std::int_least8_t}}, {{lc|std::int_least16_t}}, {{lc|std::int_least32_t}}, {{lc|std::int_least64_t}}, {{lc|std::int_fast8_t}}, {{lc|std::int_fast16_t}}, {{lc|std::int_fast32_t}}, {{lc|std::int_fast64_t}}, {{lc|std::intmax_t}}, {{lc|std::intptr_t}} respectively, equivalent to {{tt|d}} for {{c/core|int}}|nolink=true}}
 +
{{dsc macro const|SCNi8<br>SCNi16<br>SCNi32<br>SCNi64<br>SCNiLEAST8<br>SCNiLEAST16<br>SCNiLEAST32<br>SCNiLEAST64<br>SCNiFAST8<br>SCNiFAST16<br>SCNiFAST32<br>SCNiFAST64<br>SCNiMAX<br>SCNiPTR|notes={{mark c++11}}|format conversion specifier to input a signed decimal/octal/hexadecimal integer value of type {{lc|std::int8_t}}, {{lc|std::int16_t}}, {{lc|std::int32_t}}, {{lc|std::int64_t}}, {{lc|std::int_least8_t}}, {{lc|std::int_least16_t}}, {{lc|std::int_least32_t}}, {{lc|std::int_least64_t}}, {{lc|std::int_fast8_t}}, {{lc|std::int_fast16_t}}, {{lc|std::int_fast32_t}}, {{lc|std::int_fast64_t}}, {{lc|std::intmax_t}}, {{lc|std::intptr_t}} respectively, equivalent to {{tt|i}} for {{c/core|int}}|nolink=true}}
 +
{{dsc macro const|SCNu8<br>SCNu16<br>SCNu32<br>SCNu64<br>SCNuLEAST8<br>SCNuLEAST16<br>SCNuLEAST32<br>SCNuLEAST64<br>SCNuFAST8<br>SCNuFAST16<br>SCNuFAST32<br>SCNuFAST64<br>SCNuMAX<br>SCNuPTR|notes={{mark c++11}}|format conversion specifier to input an unsigned decimal integer value of type {{lc|std::uint8_t}}, {{lc|std::uint16_t}}, {{lc|std::uint32_t}}, {{lc|std::uint64_t}}, {{lc|std::uint_least8_t}}, {{lc|std::uint_least16_t}}, {{lc|std::uint_least32_t}}, {{lc|std::uint_least64_t}}, {{lc|std::uint_fast8_t}}, {{lc|std::uint_fast16_t}}, {{lc|std::uint_fast32_t}}, {{lc|std::uint_fast64_t}}, {{lc|std::uintmax_t}}, {{lc|std::uintptr_t}} respectively, equivalent to {{tt|u}} for {{c/core|unsigned int}}|nolink=true}}
 +
{{dsc macro const|SCNo8<br>SCNo16<br>SCNo32<br>SCNo64<br>SCNoLEAST8<br>SCNoLEAST16<br>SCNoLEAST32<br>SCNoLEAST64<br>SCNoFAST8<br>SCNoFAST16<br>SCNoFAST32<br>SCNoFAST64<br>SCNoMAX<br>SCNoPTR|notes={{mark c++11}}|format conversion specifier to input an unsigned octal integer value of type {{lc|std::uint8_t}}, {{lc|std::uint16_t}}, {{lc|std::uint32_t}}, {{lc|std::uint64_t}}, {{lc|std::uint_least8_t}}, {{lc|std::uint_least16_t}}, {{lc|std::uint_least32_t}}, {{lc|std::uint_least64_t}}, {{lc|std::uint_fast8_t}}, {{lc|std::uint_fast16_t}}, {{lc|std::uint_fast32_t}}, {{lc|std::uint_fast64_t}}, {{lc|std::uintmax_t}}, {{lc|std::uintptr_t}} respectively, equivalent to {{tt|o}} for {{c/core|unsigned int}}|nolink=true}}
 +
{{dsc macro const|SCNx8<br>SCNx16<br>SCNx32<br>SCNx64<br>SCNxLEAST8<br>SCNxLEAST16<br>SCNxLEAST32<br>SCNxLEAST64<br>SCNxFAST8<br>SCNxFAST16<br>SCNxFAST32<br>SCNxFAST64<br>SCNxMAX<br>SCNxPTR|notes={{mark c++11}}|format conversion specifier to input an unsigned hexadecimal integer value of type {{lc|std::uint8_t}}, {{lc|std::uint16_t}}, {{lc|std::uint32_t}}, {{lc|std::uint64_t}}, {{lc|std::uint_least8_t}}, {{lc|std::uint_least16_t}}, {{lc|std::uint_least32_t}}, {{lc|std::uint_least64_t}}, {{lc|std::uint_fast8_t}}, {{lc|std::uint_fast16_t}}, {{lc|std::uint_fast32_t}}, {{lc|std::uint_fast64_t}}, {{lc|std::uintmax_t}}, {{lc|std::uintptr_t}} respectively, equivalent to {{tt|x}} for {{c/core|unsigned int}}|nolink=true}}
 +
<!--{{dsc macro const|SCNX8<br>SCNX16<br>SCNX32<br>SCNX64<br>SCNXLEAST8<br>SCNXLEAST16<br>SCNXLEAST32<br>SCNXLEAST64<br>SCNXFAST8<br>SCNXFAST16<br>SCNXFAST32<br>SCNXFAST64<br>SCNXMAX<br>SCNXPTR|format conversion specifier to input an unsigned uppercase hexadecimal integer value of type {{lc|std::uint8_t}}, {{lc|std::uint16_t}}, {{lc|std::uint32_t}}, {{lc|std::uint64_t}}, {{lc|std::uint_least8_t}}, {{lc|std::uint_least16_t}}, {{lc|std::uint_least32_t}}, {{lc|std::uint_least64_t}}, {{lc|std::uint_fast8_t}}, {{lc|std::uint_fast16_t}}, {{lc|std::uint_fast32_t}}, {{lc|std::uint_fast64_t}}, {{lc|std::uintmax_t}}, {{lc|std::uintptr_t}} respectively, equivalent to {{tt|X}} for {{c/core|unsigned int}}|nolink=true}}-->
 
{{dsc end}}
 
{{dsc end}}
  
===Macros===
+
===Synopsis===
{{dsc begin}}
+
{{source|1=
{{dsc h2 | Format constants for the {{lc|std::fprintf}} family of functions}}
+
#include <cstdint>
{{dsc macro const | PRId8<br>PRId16<br>PRId32<br>PRId64<br>PRIdLEAST8<br>PRIdLEAST16<br>PRIdLEAST32<br>PRIdLEAST64<br>PRIdFAST8<br>PRIdFAST16<br>PRIdFAST32<br>PRIdFAST64<br>PRIdMAX<br>PRIdPTR | format conversion specifier to output a signed decimal integer value of type {{lc|std::int8_t}}, {{lc|std::int16_t}}, {{lc|std::int32_t}}, {{lc|std::int64_t}}, {{lc|std::int_least8_t}}, {{lc|std::int_least16_t}}, {{lc|std::int_least32_t}}, {{lc|std::int_least64_t}}, {{lc|std::int_fast8_t}}, {{lc|std::int_fast16_t}}, {{lc|std::int_fast32_t}}, {{lc|std::int_fast64_t}}, {{lc|std::intmax_t}}, {{lc|std::intptr_t}} respectively, equivalent to {{tt|%d}} for {{c|int}} | nolink=true }}
+
 
{{dsc macro const | PRIi8<br>PRIi16<br>PRIi32<br>PRIi64<br>PRIiLEAST8<br>PRIiLEAST16<br>PRIiLEAST32<br>PRIiLEAST64<br>PRIiFAST8<br>PRIiFAST16<br>PRIiFAST32<br>PRIiFAST64<br>PRIiMAX<br>PRIiPTR | format conversion specifier to output a signed decimal integer value of type {{lc|std::int8_t}}, {{lc|std::int16_t}}, {{lc|std::int32_t}}, {{lc|std::int64_t}}, {{lc|std::int_least8_t}}, {{lc|std::int_least16_t}}, {{lc|std::int_least32_t}}, {{lc|std::int_least64_t}}, {{lc|std::int_fast8_t}}, {{lc|std::int_fast16_t}}, {{lc|std::int_fast32_t}}, {{lc|std::int_fast64_t}}, {{lc|std::intmax_t}}, {{lc|std::intptr_t}} respectively, equivalent to {{tt|%i}} for {{c|int}} | nolink=true }}
+
namespace std
{{dsc macro const | PRIu8<br>PRIu16<br>PRIu32<br>PRIu64<br>PRIuLEAST8<br>PRIuLEAST16<br>PRIuLEAST32<br>PRIuLEAST64<br>PRIuFAST8<br>PRIuFAST16<br>PRIuFAST32<br>PRIuFAST64<br>PRIuMAX<br>PRIuPTR | format conversion specifier to output an unsigned decimal integer value of type {{lc|std::uint8_t}}, {{lc|std::uint16_t}}, {{lc|std::uint32_t}}, {{lc|std::uint64_t}}, {{lc|std::uint_least8_t}}, {{lc|std::uint_least16_t}}, {{lc|std::uint_least32_t}}, {{lc|std::uint_least64_t}}, {{lc|std::uint_fast8_t}}, {{lc|std::uint_fast16_t}}, {{lc|std::uint_fast32_t}}, {{lc|std::uint_fast64_t}}, {{lc|std::uintmax_t}}, {{lc|std::uintptr_t}} respectively, equivalent to {{tt|%u}} for {{c|unsigned int}} | nolink=true }}
+
{
{{dsc macro const | PRIo8<br>PRIo16<br>PRIo32<br>PRIo64<br>PRIoLEAST8<br>PRIoLEAST16<br>PRIoLEAST32<br>PRIoLEAST64<br>PRIoFAST8<br>PRIoFAST16<br>PRIoFAST32<br>PRIoFAST64<br>PRIoMAX<br>PRIoPTR | format conversion specifier to output an unsigned octal integer value of type {{lc|std::uint8_t}}, {{lc|std::uint16_t}}, {{lc|std::uint32_t}}, {{lc|std::uint64_t}}, {{lc|std::uint_least8_t}}, {{lc|std::uint_least16_t}}, {{lc|std::uint_least32_t}}, {{lc|std::uint_least64_t}}, {{lc|std::uint_fast8_t}}, {{lc|std::uint_fast16_t}}, {{lc|std::uint_fast32_t}}, {{lc|std::uint_fast64_t}}, {{lc|std::uintmax_t}}, {{lc|std::uintptr_t}} respectively, equivalent to {{tt|%o}} for {{c|unsigned int}} | nolink=true }}
+
    using imaxdiv_t = /* see description */;
{{dsc macro const | PRIx8<br>PRIx16<br>PRIx32<br>PRIx64<br>PRIxLEAST8<br>PRIxLEAST16<br>PRIxLEAST32<br>PRIxLEAST64<br>PRIxFAST8<br>PRIxFAST16<br>PRIxFAST32<br>PRIxFAST64<br>PRIxMAX<br>PRIxPTR | format conversion specifier to output an unsigned hexadecimal integer value of type {{lc|std::uint8_t}}, {{lc|std::uint16_t}}, {{lc|std::uint32_t}}, {{lc|std::uint64_t}}, {{lc|std::uint_least8_t}}, {{lc|std::uint_least16_t}}, {{lc|std::uint_least32_t}}, {{lc|std::uint_least64_t}}, {{lc|std::uint_fast8_t}}, {{lc|std::uint_fast16_t}}, {{lc|std::uint_fast32_t}}, {{lc|std::uint_fast64_t}}, {{lc|std::uintmax_t}}, {{lc|std::uintptr_t}} respectively, equivalent to {{tt|%x}} for {{c|unsigned int}} | nolink=true }}
+
 
{{dsc macro const | PRIX8<br>PRIX16<br>PRIX32<br>PRIX64<br>PRIXLEAST8<br>PRIXLEAST16<br>PRIXLEAST32<br>PRIXLEAST64<br>PRIXFAST8<br>PRIXFAST16<br>PRIXFAST32<br>PRIXFAST64<br>PRIXMAX<br>PRIXPTR | format conversion specifier to output an unsigned uppercase hexadecimal integer value of type {{lc|std::uint8_t}}, {{lc|std::uint16_t}}, {{lc|std::uint32_t}}, {{lc|std::uint64_t}}, {{lc|std::uint_least8_t}}, {{lc|std::uint_least16_t}}, {{lc|std::uint_least32_t}}, {{lc|std::uint_least64_t}}, {{lc|std::uint_fast8_t}}, {{lc|std::uint_fast16_t}}, {{lc|std::uint_fast32_t}}, {{lc|std::uint_fast64_t}}, {{lc|std::uintmax_t}}, {{lc|std::uintptr_t}} respectively, equivalent to {{tt|%X}} for {{c|unsigned int}} | nolink=true }}
+
    constexpr intmax_t imaxabs(intmax_t j);
{{dsc h2 | Format constants for the {{lc|std::fscanf}} family of functions}}
+
    constexpr imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom);
{{dsc macro const | SCNd8<br>SCNd16<br>SCNd32<br>SCNd64<br>SCNdLEAST8<br>SCNdLEAST16<br>SCNdLEAST32<br>SCNdLEAST64<br>SCNdFAST8<br>SCNdFAST16<br>SCNdFAST32<br>SCNdFAST64<br>SCNdMAX<br>SCNdPTR | format conversion specifier to input a signed decimal integer value of type {{lc|std::int8_t}}, {{lc|std::int16_t}}, {{lc|std::int32_t}}, {{lc|std::int64_t}}, {{lc|std::int_least8_t}}, {{lc|std::int_least16_t}}, {{lc|std::int_least32_t}}, {{lc|std::int_least64_t}}, {{lc|std::int_fast8_t}}, {{lc|std::int_fast16_t}}, {{lc|std::int_fast32_t}}, {{lc|std::int_fast64_t}}, {{lc|std::intmax_t}}, {{lc|std::intptr_t}} respectively, equivalent to {{tt|%d}} for {{c|int}} | nolink=true }}
+
    intmax_t strtoimax(const char* nptr, char** endptr, int base);
{{dsc macro const | SCNi8<br>SCNi16<br>SCNi32<br>SCNi64<br>SCNiLEAST8<br>SCNiLEAST16<br>SCNiLEAST32<br>SCNiLEAST64<br>SCNiFAST8<br>SCNiFAST16<br>SCNiFAST32<br>SCNiFAST64<br>SCNiMAX<br>SCNiPTR | format conversion specifier to input a signed decimal/octal/hexadecimal integer value of type {{lc|std::int8_t}}, {{lc|std::int16_t}}, {{lc|std::int32_t}}, {{lc|std::int64_t}}, {{lc|std::int_least8_t}}, {{lc|std::int_least16_t}}, {{lc|std::int_least32_t}}, {{lc|std::int_least64_t}}, {{lc|std::int_fast8_t}}, {{lc|std::int_fast16_t}}, {{lc|std::int_fast32_t}}, {{lc|std::int_fast64_t}}, {{lc|std::intmax_t}}, {{lc|std::intptr_t}} respectively, equivalent to {{tt|%i}} for {{c|int}} | nolink=true }}
+
    uintmax_t strtoumax(const char* nptr, char** endptr, int base);
{{dsc macro const | SCNu8<br>SCNu16<br>SCNu32<br>SCNu64<br>SCNuLEAST8<br>SCNuLEAST16<br>SCNuLEAST32<br>SCNuLEAST64<br>SCNuFAST8<br>SCNuFAST16<br>SCNuFAST32<br>SCNuFAST64<br>SCNuMAX<br>SCNuPTR | format conversion specifier to input an unsigned decimal integer value of type {{lc|std::uint8_t}}, {{lc|std::uint16_t}}, {{lc|std::uint32_t}}, {{lc|std::uint64_t}}, {{lc|std::uint_least8_t}}, {{lc|std::uint_least16_t}}, {{lc|std::uint_least32_t}}, {{lc|std::uint_least64_t}}, {{lc|std::uint_fast8_t}}, {{lc|std::uint_fast16_t}}, {{lc|std::uint_fast32_t}}, {{lc|std::uint_fast64_t}}, {{lc|std::uintmax_t}}, {{lc|std::uintptr_t}} respectively, equivalent to {{tt|%u}} for {{c|unsigned int}} | nolink=true }}
+
    intmax_t wcstoimax(const wchar_t* nptr, wchar_t** endptr, int base);
{{dsc macro const | SCNo8<br>SCNo16<br>SCNo32<br>SCNo64<br>SCNoLEAST8<br>SCNoLEAST16<br>SCNoLEAST32<br>SCNoLEAST64<br>SCNoFAST8<br>SCNoFAST16<br>SCNoFAST32<br>SCNoFAST64<br>SCNoMAX<br>SCNoPTR | format conversion specifier to input an unsigned octal integer value of type {{lc|std::uint8_t}}, {{lc|std::uint16_t}}, {{lc|std::uint32_t}}, {{lc|std::uint64_t}}, {{lc|std::uint_least8_t}}, {{lc|std::uint_least16_t}}, {{lc|std::uint_least32_t}}, {{lc|std::uint_least64_t}}, {{lc|std::uint_fast8_t}}, {{lc|std::uint_fast16_t}}, {{lc|std::uint_fast32_t}}, {{lc|std::uint_fast64_t}}, {{lc|std::uintmax_t}}, {{lc|std::uintptr_t}} respectively, equivalent to {{tt|%o}} for {{c|unsigned int}} | nolink=true }}
+
    uintmax_t wcstoumax(const wchar_t* nptr, wchar_t** endptr, int base);
{{dsc macro const | SCNx8<br>SCNx16<br>SCNx32<br>SCNx64<br>SCNxLEAST8<br>SCNxLEAST16<br>SCNxLEAST32<br>SCNxLEAST64<br>SCNxFAST8<br>SCNxFAST16<br>SCNxFAST32<br>SCNxFAST64<br>SCNxMAX<br>SCNxPTR | format conversion specifier to input an unsigned hexadecimal integer value of type {{lc|std::uint8_t}}, {{lc|std::uint16_t}}, {{lc|std::uint32_t}}, {{lc|std::uint64_t}}, {{lc|std::uint_least8_t}}, {{lc|std::uint_least16_t}}, {{lc|std::uint_least32_t}}, {{lc|std::uint_least64_t}}, {{lc|std::uint_fast8_t}}, {{lc|std::uint_fast16_t}}, {{lc|std::uint_fast32_t}}, {{lc|std::uint_fast64_t}}, {{lc|std::uintmax_t}}, {{lc|std::uintptr_t}} respectively, equivalent to {{tt|%x}} for {{c|unsigned int}} | nolink=true }}
+
 
{{dsc macro const | SCNX8<br>SCNX16<br>SCNX32<br>SCNX64<br>SCNXLEAST8<br>SCNXLEAST16<br>SCNXLEAST32<br>SCNXLEAST64<br>SCNXFAST8<br>SCNXFAST16<br>SCNXFAST32<br>SCNXFAST64<br>SCNXMAX<br>SCNXPTR | format conversion specifier to input an unsigned uppercase hexadecimal integer value of type {{lc|std::uint8_t}}, {{lc|std::uint16_t}}, {{lc|std::uint32_t}}, {{lc|std::uint64_t}}, {{lc|std::uint_least8_t}}, {{lc|std::uint_least16_t}}, {{lc|std::uint_least32_t}}, {{lc|std::uint_least64_t}}, {{lc|std::uint_fast8_t}}, {{lc|std::uint_fast16_t}}, {{lc|std::uint_fast32_t}}, {{lc|std::uint_fast64_t}}, {{lc|std::uintmax_t}}, {{lc|std::uintptr_t}} respectively, equivalent to {{tt|%X}} for {{c|unsigned int}} | nolink=true }}
+
    constexpr intmax_t abs(intmax_t);            // optional, see description
{{dsc end}}
+
    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 SCNdN /* see description */
 +
#define SCNiN /* see description */
 +
#define SCNoN /* see description */
 +
#define SCNuN /* see description */
 +
#define SCNxN /* 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 SCNdLEASTN /* see description */
 +
#define SCNiLEASTN /* see description */
 +
#define SCNoLEASTN /* see description */
 +
#define SCNuLEASTN /* see description */
 +
#define SCNxLEASTN /* 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 SCNdFASTN /* see description */
 +
#define SCNiFASTN /* see description */
 +
#define SCNoFASTN /* see description */
 +
#define SCNuFASTN /* see description */
 +
#define SCNxFASTN /* 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 SCNdMAX /* see description */
 +
#define SCNiMAX /* see description */
 +
#define SCNoMAX /* see description */
 +
#define SCNuMAX /* see description */
 +
#define SCNxMAX /* 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 SCNdPTR /* see description */
 +
#define SCNiPTR /* see description */
 +
#define SCNoPTR /* see description */
 +
#define SCNuPTR /* see description */
 +
#define SCNxPTR /* see description */
 +
}}
 +
 
 +
{{langlinks|es|ja|ru|zh}}

Latest revision as of 13:37, 11 August 2023

 
 
Standard library headers
 

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

Contents

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
PRId8PRId16PRId32PRId64PRIdLEAST8PRIdLEAST16PRIdLEAST32PRIdLEAST64PRIdFAST8PRIdFAST16PRIdFAST32PRIdFAST64PRIdMAXPRIdPTR
(C++11)
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
(C++11)
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
(C++11)
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
(C++11)
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
(C++11)
format conversion specifier to output an unsigned lowercase 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
(C++11)
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
(C++11)
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
(C++11)
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
(C++11)
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
(C++11)
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
(C++11)
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)

[edit] Synopsis

#include <cstdint>
 
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 SCNdN /* see description */
#define SCNiN /* see description */
#define SCNoN /* see description */
#define SCNuN /* see description */
#define SCNxN /* 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 SCNdLEASTN /* see description */
#define SCNiLEASTN /* see description */
#define SCNoLEASTN /* see description */
#define SCNuLEASTN /* see description */
#define SCNxLEASTN /* 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 SCNdFASTN /* see description */
#define SCNiFASTN /* see description */
#define SCNoFASTN /* see description */
#define SCNuFASTN /* see description */
#define SCNxFASTN /* 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 SCNdMAX /* see description */
#define SCNiMAX /* see description */
#define SCNoMAX /* see description */
#define SCNuMAX /* see description */
#define SCNxMAX /* 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 SCNdPTR /* see description */
#define SCNiPTR /* see description */
#define SCNoPTR /* see description */
#define SCNuPTR /* see description */
#define SCNxPTR /* see description */