[Previous] [Contents] [Next]

Caution: This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs.

<inttypes.h>

[Added with C99]


abs · div · imaxabs · imaxdiv · imaxdiv_t · strtoimax · strtoumax · wcstoimax · wcstoumax

PRId8 · PRId16 · PRId32 · PRId64 · PRIdFAST8 · PRIdFAST16 · PRIdFAST32 · PRIdFAST64 · PRIdLEAST8 · PRIdLEAST16 · PRIdLEAST32 · PRIdLEAST64 · PRIdMAX · PRIdPTR · PRIi8 · PRIi16 · PRIi32 · PRIi64 · PRIiFAST8 · PRIiFAST16 · PRIiFAST32 · PRIiFAST64 · PRIiLEAST8 · PRIiLEAST16 · PRIiLEAST32 · PRIiLEAST64 · PRIiMAX · PRIiPTR · PRIo8 · PRIo16 · PRIo32 · PRIo64 · PRIoFAST8 · PRIoFAST16 · PRIoFAST32 · PRIoFAST64 · PRIoLEAST8 · PRIoLEAST16 · PRIoLEAST32 · PRIoLEAST64 · PRIoMAX · PRIoPTR · PRIu8 · PRIu16 · PRIu32 · PRIu64 · PRIuFAST8 · PRIuFAST16 · PRIuFAST32 · PRIuFAST64 · PRIuLEAST8 · PRIuLEAST16 · PRIuLEAST32 · PRIuLEAST64 · PRIuMAX · PRIuPTR · PRIx8 · PRIx16 · PRIx32 · PRIx64 · PRIxFAST8 · PRIxFAST16 · PRIxFAST32 · PRIxFAST64 · PRIxLEAST8 · PRIxLEAST16 · PRIxLEAST32 · PRIxLEAST64 · PRIxMAX · PRIxPTR · PRIX8 · PRIX16 · PRIX32 · PRIX64 · PRIXFAST8 · PRIXFAST16 · PRIXFAST32 · PRIXFAST64 · PRIXLEAST8 · PRIXLEAST16 · PRIXLEAST32 · PRIXLEAST64 · PRIXMAX · PRIXPTR

SCNd8 · SCNd16 · SCNd32 · SCNd64 · SCNdFAST8 · SCNdFAST16 · SCNdFAST32 · SCNdFAST64 · SCNdLEAST8 · SCNdLEAST16 · SCNdLEAST32 · SCNdLEAST64 · SCNdMAX · SCNdPTR · SCNi8 · SCNi16 · SCNi32 · SCNi64 · SCNiFAST8 · SCNiFAST16 · SCNiFAST32 · SCNiFAST64 · SCNiLEAST8 · SCNiLEAST16 · SCNiLEAST32 · SCNiLEAST64 · SCNiMAX · SCNiPTR · SCNo8 · SCNo16 · SCNo32 · SCNo64 · SCNoFAST8 · SCNoFAST16 · SCNoFAST32 · SCNoFAST64 · SCNoLEAST8 · SCNoLEAST16 · SCNoLEAST32 · SCNoLEAST64 · SCNoMAX · SCNoPTR · SCNu8 · SCNu16 · SCNu32 · SCNu64 · SCNuFAST8 · SCNuFAST16 · SCNuFAST32 · SCNuFAST64 · SCNuLEAST8 · SCNuLEAST16 · SCNuLEAST32 · SCNuLEAST64 · SCNuMAX · SCNuPTR · SCNx8 · SCNx16 · SCNx32 · SCNx64 · SCNxFAST8 · SCNxFAST16 · SCNxFAST32 · SCNxFAST64 · SCNxLEAST8 · SCNxLEAST16 · SCNxLEAST32 · SCNxLEAST64 · SCNxMAX · SCNxPTR · SCNX8 · SCNX16 · SCNX32 · SCNX64 · SCNXFAST8 · SCNXFAST16 · SCNXFAST32 · SCNXFAST64 · SCNXLEAST8 · SCNXLEAST16 · SCNXLEAST32 · SCNXLEAST64 · SCNXMAX · SCNXPTR


Include the standard header <inttypes.h> to define a type, several functions, and numerous macros for fine control over the conversion of integers. Note that the definitions shown for the macros are merely representative -- they can vary among implementations.

        /* TYPE DEFINITIONS */
typedef struct {
    intmax_t quot, rem;
    } imaxdiv_t;

        /* FUNCTION DECLARATIONS */
intmax_t imaxabs(intmax_t i);
intmax_t abs(intmax_t i); [C++ only]

imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom);
imaxdiv_t div(intmax_t numer, intmax_t denom); [C++ only]

intmax_t strtoimax(const char *restrict s,
    char **restrict endptr, int base);
uintmax_t strtoumax(const char *restrict s,
    char **restrict endptr, int base);
intmax_t wcstoimax(const wchar_t *restrict s,
    wchar_t **restrict endptr, int base);
uintmax_t wcstoumax(const wchar_t *restrict s,
    wchar_t **restrict endptr, int base);

        /* PRINT FORMAT MACROS */
#define PRId8     "hhd"
#define PRId16    "hd"
#define PRId32    "ld"
#define PRId64    "lld"

#define PRIdFAST8    "hhd"
#define PRIdFAST16    "hd"
#define PRIdFAST32    "ld"
#define PRIdFAST64   "lld"

#define PRIdLEAST8   "hhd"
#define PRIdLEAST16  "hd"
#define PRIdLEAST32  "ld"
#define PRIdLEAST64  "lld"

#define PRIdMAX   "lld"
#define PRIdPTR   "lld"

#define PRIi8     "hhi"
#define PRIi16    "hi"
#define PRIi32    "li"
#define PRIi64    "lli"

#define PRIiFAST8    "hhi"
#define PRIiFAST16    "hi"
#define PRIiFAST32    "li"
#define PRIiFAST64    "lli"

#define PRIiLEAST8   "hhi"
#define PRIiLEAST16  "hi"
#define PRIiLEAST32  "li"
#define PRIiLEAST64  "lli"

#define PRIiMAX   "lli"
#define PRIiPTR   "lli"

#define PRIo8     "hho"
#define PRIo16    "ho"
#define PRIo32    "lo"
#define PRIo64    "llo"

#define PRIoFAST8    "hho"
#define PRIoFAST16    "ho"
#define PRIoFAST32    "lo"
#define PRIoFAST64   "llo"

#define PRIoLEAST8   "hho"
#define PRIoLEAST16  "ho"
#define PRIoLEAST32  "lo"
#define PRIoLEAST64  "llo"

#define PRIoMAX   "llo"
#define PRIoPTR   "llo"

#define PRIu8     "hhu"
#define PRIu16    "hu"
#define PRIu32    "lu"
#define PRIu64    "llu"

#define PRIuFAST8    "hhu"
#define PRIuFAST16    "hu"
#define PRIuFAST32    "lu"
#define PRIuFAST64   "llu"

#define PRIuLEAST8   "hhu"
#define PRIuLEAST16  "hu"
#define PRIuLEAST32  "lu"
#define PRIuLEAST64  "llu"

#define PRIuMAX   "llu"
#define PRIuPTR   "llu"

#define PRIx8     "hhx"
#define PRIx16    "hx"
#define PRIx32    "lx"
#define PRIx64    "llx"

#define PRIxFAST8    "hhx"
#define PRIxFAST16    "hx"
#define PRIxFAST32    "lx"
#define PRIxFAST64   "llx"

#define PRIxLEAST8   "hhx"
#define PRIxLEAST16  "hx"
#define PRIxLEAST32  "lx"
#define PRIxLEAST64  "llx"

#define PRIxMAX   "llx"
#define PRIxPTR   "llx"

#define PRIX8     "hhX"
#define PRIX16    "hX"
#define PRIX32    "lX"
#define PRIX64    "llX"

#define PRIXFAST8    "hhX"
#define PRIXFAST16    "hX"
#define PRIXFAST32    "lX"
#define PRIXFAST64   "llX"

#define PRIXLEAST8   "hhX"
#define PRIXLEAST16  "hX"
#define PRIXLEAST32  "lX"
#define PRIXLEAST64  "llX"

#define PRIXMAX   "llX"
#define PRIXPTR   "llX"

        /* SCAN FORMAT MACROS */
#define SCNd8     "hhd"
#define SCNd16    "hd"
#define SCNd32    "ld"
#define SCNd64    "lld"

#define SCNdFAST8    "hhd"
#define SCNdFAST16    "hd"
#define SCNdFAST32    "ld"
#define SCNdFAST64   "lld"

#define SCNdLEAST8   "hhd"
#define SCNdLEAST16  "hd"
#define SCNdLEAST32  "ld"
#define SCNdLEAST64  "lld"

#define SCNdMAX   "lld"
#define SCNdPTR   "lld"

#define SCNi8     "hhi"
#define SCNi16    "hi"
#define SCNi32    "li"
#define SCNi64    "lli"

#define SCNiFAST8    "hhi"
#define SCNiFAST16    "hi"
#define SCNiFAST32    "li"
#define SCNiFAST64   "lli"

#define SCNiLEAST8   "hhi"
#define SCNiLEAST16  "hi"
#define SCNiLEAST32  "li"
#define SCNiLEAST64  "lli"

#define SCNiMAX   "lli"
#define SCNiPTR   "lli"

#define SCNo8     "hho"
#define SCNo16    "ho"
#define SCNo32    "lo"
#define SCNo64    "llo"

#define SCNoFAST8    "hho"
#define SCNoFAST16    "ho"
#define SCNoFAST32    "lo"
#define SCNoFAST64   "llo"

#define SCNoLEAST8   "hho"
#define SCNoLEAST16  "ho"
#define SCNoLEAST32  "lo"
#define SCNoLEAST64  "llo"

#define SCNoMAX   "llo"
#define SCNoPTR   "llo"

#define SCNu8     "hhu"
#define SCNu16    "hu"
#define SCNu32    "lu"
#define SCNu64    "llu"

#define SCNuFAST8    "hhu"
#define SCNuFAST16    "hu"
#define SCNuFAST32    "lu"
#define SCNuFAST64   "llu"

#define SCNuLEAST8   "hhu"
#define SCNuLEAST16  "hu"
#define SCNuLEAST32  "lu"
#define SCNuLEAST64  "llu"

#define SCNuMAX   "llu"
#define SCNuPTR   "llu"

#define SCNx8     "hhx"
#define SCNx16    "hx"
#define SCNx32    "lx"
#define SCNx64    "llx"

#define SCNxFAST8    "hhx"
#define SCNxFAST16    "hx"
#define SCNxFAST32    "lx"
#define SCNxFAST64   "llx"

#define SCNxLEAST8   "hhx"
#define SCNxLEAST16  "hx"
#define SCNxLEAST32  "lx"
#define SCNxLEAST64  "llx"

#define SCNxMAX   "llx"
#define SCNxPTR   "llx"

#define SCNX8     "hhX"
#define SCNX16    "hX"
#define SCNX32    "lX"
#define SCNX64    "llX"

#define SCNXFAST8    "hhX"
#define SCNXFAST16    "hX"
#define SCNXFAST32    "lX"
#define SCNXFAST64   "llX"

#define SCNXLEAST8   "hhX"
#define SCNXLEAST16  "hX"
#define SCNXLEAST32  "lX"
#define SCNXLEAST64  "llX"

#define SCNXMAX   "llX"
#define SCNXPTR   "llX"

imaxabs, abs

intmax_t imaxabs(intmax_t i);
intmax_t abs(intmax_t i); [C++ only]

The function returns the absolute value of i, |i|.

imaxdiv, div

imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom);
imaxdiv_t div(intmax_t numer, intmax_t denom); [C++ only]

The function divides numer by denom and returns both quotient and remainder in the structure result x, if the quotient can be represented. The structure member x.quot is the algebraic quotient truncated toward zero. The structure member x.rem is the remainder, such that numer == x.quot*denom + x.rem.

imaxdiv_t

typedef struct {
    intmax_t quot, rem;
    } imaxdiv_t;

The type is the structure type returned by the function imaxdiv. The structure contains members that represent the quotient (quot) and remainder (rem) of a signed integer division with operands of type intmax_t. The members shown above can occur in either order.

PRId8, PRId16, PRId32, PRId64

#define PRId8     "hhd"
#define PRId16    "hd"
#define PRId32    "ld"
#define PRId64    "lld"

The macros each expand to a string literal suitable for use as a d print conversion specificier, plus any needed qualifiers, to convert values of the types int8_t, int16_t, int32_t, or int64_t, respectively. Note that the definitions shown here are merely representative.

PRIdFAST8, PRIdFAST16, PRIdFAST32, PRIdFAST64

#define PRIdFAST8    "hhd"
#define PRIdFAST16    "hd"
#define PRIdFAST32    "ld"
#define PRIdFAST64   "lld"

The macros each expand to a string literal suitable for use as a d print conversion specificier, plus any needed qualifiers, to convert values of the types int_fast8_t, int_fast16_t, int_fast32_t, or int_fast64_t, respectively. Note that the definitions shown here are merely representative.

PRIdLEAST8, PRIdLEAST16, PRIdLEAST32, PRIdLEAST64

#define PRIdLEAST8   "hhd"
#define PRIdLEAST16  "hd"
#define PRIdLEAST32  "ld"
#define PRIdLEAST64  "lld"

The macros each expand to a string literal suitable for use as a d print conversion specificier, plus any needed qualifiers, to convert values of the types int_least8_t, int_least16_t, int_least32_t, or int_least64_t, respectively. Note that the definitions shown here are merely representative.

PRIdMAX

#define PRIdMAX   "lld"

The macro expands to a string literal suitable for use as a d print conversion specificier, plus any needed qualifiers, to convert values of the types intmax_t. Note that the definition shown here is merely representative.

PRIdPTR

#define PRIdPTR   "lld"

The macro expands to a string literal suitable for use as a d print conversion specificier, plus any needed qualifiers, to convert values of the types intptr_t. Note that the definition shown here is merely representative.

PRIi8, PRIi16, PRIi32, PRIi64

#define PRIi8     "hhi"
#define PRIi16    "hi"
#define PRIi32    "li"
#define PRIi64    "lli"

The macros each expand to a string literal suitable for use as an i print conversion specificier, plus any needed qualifiers, to convert values of the types int8_t, int16_t, int32_t, or int64_t, respectively. Note that the definitions shown here are merely representative.

PRIiFAST8, PRIiFAST16, PRIiFAST32, PRIiFAST64

#define PRIiFAST8    "hhi"
#define PRIiFAST16    "hi"
#define PRIiFAST32    "li"
#define PRIiFAST64   "lli"

The macros each expand to a string literal suitable for use as an i print conversion specificier, plus any needed qualifiers, to convert values of the types int_fast8_t, int_fast16_t, int_fast32_t, or int_fast64_t, respectively. Note that the definitions shown here are merely representative.

PRIiLEAST8, PRIiLEAST16, PRIiLEAST32, PRIiLEAST64

#define PRIiLEAST8   "hhi"
#define PRIiLEAST16  "hi"
#define PRIiLEAST32  "li"
#define PRIiLEAST64  "lli"

The macros each expand to a string literal suitable for use as an i print conversion specificier, plus any needed qualifiers, to convert values of the types int_least8_t, int_least16_t, int_least32_t, or int_least64_t, respectively. Note that the definitions shown here are merely representative.

PRIiMAX

#define PRIiMAX   "lli"

The macro expands to a string literal suitable for use as an i print conversion specificier, plus any needed qualifiers, to convert values of the types intmax_t. Note that the definition shown here is merely representative.

PRIiPTR

#define PRIiPTR   "lli"

The macro expands to a string literal suitable for use as an i print conversion specificier, plus any needed qualifiers, to convert values of the types intptr_t. Note that the definition shown here is merely representative.

PRIo8, PRIo16, PRIo32, PRIo64

#define PRIo8     "hho"
#define PRIo16    "ho"
#define PRIo32    "lo"
#define PRIo64    "llo"

The macros each expand to a string literal suitable for use as an o print conversion specificier, plus any needed qualifiers, to convert values of the types uint8_t, uint16_t, uint32_t, or uint64_t, respectively. Note that the definitions shown here are merely representative.

PRIoFAST8, PRIoFAST16, PRIoFAST32, PRIoFAST64

#define PRIoFAST8    "hho"
#define PRIoFAST16    "ho"
#define PRIoFAST32    "lo"
#define PRIoFAST64   "llo"

The macros each expand to a string literal suitable for use as an o print conversion specificier, plus any needed qualifiers, to convert values of the types uint_fast8_t, uint_fast16_t, uint_fast32_t, or uint_fast64_t, respectively. Note that the definitions shown here are merely representative.

PRIoLEAST8, PRIoLEAST16, PRIoLEAST32, PRIoLEAST64

#define PRIoLEAST8   "hho"
#define PRIoLEAST16  "ho"
#define PRIoLEAST32  "lo"
#define PRIoLEAST64  "llo"

The macros each expand to a string literal suitable for use as an o print conversion specificier, plus any needed qualifiers, to convert values of the types uint_least8_t, uint_least16_t, uint_least32_t, or uint_least64_t, respectively. Note that the definitions shown here are merely representative.

PRIoMAX

#define PRIoMAX   "llo"

The macro expands to a string literal suitable for use as an o print conversion specificier, plus any needed qualifiers, to convert values of the types uintmax_t. Note that the definition shown here is merely representative.

PRIoPTR

#define PRIoPTR   "llo"

The macro expands to a string literal suitable for use as an o print conversion specificier, plus any needed qualifiers, to convert values of the types uintptr_t. Note that the definition shown here is merely representative.

PRIu8, PRIu16, PRIu32, PRIu64

#define PRIu8     "hhu"
#define PRIu16    "hu"
#define PRIu32    "lu"
#define PRIu64    "llu"

The macros each expand to a string literal suitable for use as a u print conversion specificier, plus any needed qualifiers, to convert values of the types uint8_t, uint16_t, uint32_t, or uint64_t, respectively. Note that the definitions shown here are merely representative.

PRIuFAST8, PRIuFAST16, PRIuFAST32, PRIuFAST64

#define PRIuFAST8    "hhu"
#define PRIuFAST16    "hu"
#define PRIuFAST32    "lu"
#define PRIuFAST64   "llu"

The macros each expand to a string literal suitable for use as a u print conversion specificier, plus any needed qualifiers, to convert values of the types uint_fast8_t, uint_fast16_t, uint_fast32_t, or uint_fast64_t, respectively. Note that the definitions shown here are merely representative.

PRIuLEAST8, PRIuLEAST16, PRIuLEAST32, PRIuLEAST64

#define PRIuLEAST8   "hhu"
#define PRIuLEAST16  "hu"
#define PRIuLEAST32  "lu"
#define PRIuLEAST64  "llu"

The macros each expand to a string literal suitable for use as a u print conversion specificier, plus any needed qualifiers, to convert values of the types uint_least8_t, uint_least16_t, uint_least32_t, or uint_least64_t, respectively. Note that the definitions shown here are merely representative.

PRIuMAX

#define PRIuMAX   "llu"

The macro expands to a string literal suitable for use as a u print conversion specificier, plus any needed qualifiers, to convert values of the types uintmax_t. Note that the definition shown here is merely representative.

PRIuPTR

#define PRIuPTR   "llu"

The macro expands to a string literal suitable for use as a u print conversion specificier, plus any needed qualifiers, to convert values of the types uintptr_t. Note that the definition shown here is merely representative.

PRIx8, PRIx16, PRIx32, PRIx64

#define PRIx8     "hhx"
#define PRIx16    "hx"
#define PRIx32    "lx"
#define PRIx64    "llx"

The macros each expand to a string literal suitable for use as an x print conversion specificier, plus any needed qualifiers, to convert values of the types uint8_t, uint16_t, uint32_t, or uint64_t, respectively. Note that the definitions shown here are merely representative.

PRIxFAST8, PRIxFAST16, PRIxFAST32, PRIxFAST64

#define PRIxFAST8    "hhx"
#define PRIxFAST16    "hx"
#define PRIxFAST32    "lx"
#define PRIxFAST64   "llx"

The macros each expand to a string literal suitable for use as an x print conversion specificier, plus any needed qualifiers, to convert values of the types uint_fast8_t, uint_fast16_t, uint_fast32_t, or uint_fast64_t, respectively. Note that the definitions shown here are merely representative.

PRIxLEAST8, PRIxLEAST16, PRIxLEAST32, PRIxLEAST64

#define PRIxLEAST8   "hhx"
#define PRIxLEAST16  "hx"
#define PRIxLEAST32  "lx"
#define PRIxLEAST64  "llx"

The macros each expand to a string literal suitable for use as an x print conversion specificier, plus any needed qualifiers, to convert values of the types uint_least8_t, uint_least16_t, uint_least32_t, or uint_least64_t, respectively. Note that the definitions shown here are merely representative.

PRIxMAX

#define PRIxMAX   "llx"

The macro expands to a string literal suitable for use as an x print conversion specificier, plus any needed qualifiers, to convert values of the types uintmax_t. Note that the definition shown here is merely representative.

PRIxPTR

#define PRIxPTR   "llx"

The macro expands to a string literal suitable for use as an x print conversion specificier, plus any needed qualifiers, to convert values of the types uintptr_t. Note that the definition shown here is merely representative.

PRIX8, PRIX16, PRIX32, PRIX64

#define PRIX8     "hhX"
#define PRIX16    "hX"
#define PRIX32    "lX"
#define PRIX64    "llX"

The macros each expand to a string literal suitable for use as an X print conversion specificier, plus any needed qualifiers, to convert values of the types uint8_t, uint16_t, uint32_t, or uint64_t, respectively. Note that the definitions shown here are merely representative.

PRIXFAST8, PRIXFAST16, PRIXFAST32, PRIXFAST64

#define PRIXFAST8    "hhX"
#define PRIXFAST16    "hX"
#define PRIXFAST32    "lX"
#define PRIXFAST64   "llX"

The macros each expand to a string literal suitable for use as an X print conversion specificier, plus any needed qualifiers, to convert values of the types uint_fast8_t, uint_fast16_t, uint_fast32_t, or uint_fast64_t, respectively. Note that the definitions shown here are merely representative.

PRIXLEAST8, PRIXLEAST16, PRIXLEAST32, PRIXLEAST64

#define PRIXLEAST8   "hhX"
#define PRIXLEAST16  "hX"
#define PRIXLEAST32  "lX"
#define PRIXLEAST64  "llX"

The macros each expand to a string literal suitable for use as an X print conversion specificier, plus any needed qualifiers, to convert values of the types uint_least8_t, uint_least16_t, uint_least32_t, or uint_least64_t, respectively. Note that the definitions shown here are merely representative.

PRIXMAX

#define PRIXMAX   "llX"

The macro expands to a string literal suitable for use as an X print conversion specificier, plus any needed qualifiers, to convert values of the types uintmax_t. Note that the definition shown here is merely representative.

PRIXPTR

#define PRIXPTR   "llX"

The macro expands to a string literal suitable for use as an X print conversion specificier, plus any needed qualifiers, to convert values of the types uintptr_t. Note that the definition shown here is merely representative.

SCNd8, SCNd16, SCNd32, SCNd64

#define SCNd8     "hhd"
#define SCNd16    "hd"
#define SCNd32    "ld"
#define SCNd64    "lld"

The macros each expand to a string literal suitable for use as a d scan conversion specificier, plus any needed qualifiers, to convert values of the types int8_t, int16_t, int32_t, or int64_t, respectively. Note that the definitions shown here are merely representative.

SCNdFAST8, SCNdFAST16, SCNdFAST32, SCNdFAST64

#define SCNdFAST8    "hhd"
#define SCNdFAST16    "hd"
#define SCNdFAST32    "ld"
#define SCNdFAST64   "lld"

The macros each expand to a string literal suitable for use as a d scan conversion specificier, plus any needed qualifiers, to convert values of the types int_fast8_t, int_fast16_t, int_fast32_t, or int_fast64_t, respectively. Note that the definitions shown here are merely representative.

SCNdLEAST8, SCNdLEAST16, SCNdLEAST32, SCNdLEAST64

#define SCNdLEAST8   "hhd"
#define SCNdLEAST16  "hd"
#define SCNdLEAST32  "ld"
#define SCNdLEAST64  "lld"

The macros each expand to a string literal suitable for use as a d scan conversion specificier, plus any needed qualifiers, to convert values of the types int_least8_t, int_least16_t, int_least32_t, or int_least64_t, respectively. Note that the definitions shown here are merely representative.

SCNdMAX

#define SCNdMAX   "lld"

The macro expands to a string literal suitable for use as a d scan conversion specificier, plus any needed qualifiers, to convert values of the types intmax_t. Note that the definition shown here is merely representative.

SCNdPTR

#define SCNdPTR   "lld"

The macro expands to a string literal suitable for use as a d scan conversion specificier, plus any needed qualifiers, to convert values of the types intptr_t. Note that the definition shown here is merely representative.

SCNi8, SCNi16, SCNi32, SCNi64

#define SCNi8     "hhi"
#define SCNi16    "hi"
#define SCNi32    "li"
#define SCNi64    "lli"

The macros each expand to a string literal suitable for use as an i scan conversion specificier, plus any needed qualifiers, to convert values of the types int8_t, int16_t, int32_t, or int64_t, respectively. Note that the definitions shown here are merely representative.

SCNiFAST8, SCNiFAST16, SCNiFAST32, SCNiFAST64

#define SCNiFAST8    "hhi"
#define SCNiFAST16    "hi"
#define SCNiFAST32    "li"
#define SCNiFAST64   "lli"

The macros each expand to a string literal suitable for use as an i scan conversion specificier, plus any needed qualifiers, to convert values of the types int_fast8_t, int_fast16_t, int_fast32_t, or int_fast64_t, respectively. Note that the definitions shown here are merely representative.

SCNiLEAST8, SCNiLEAST16, SCNiLEAST32, SCNiLEAST64

#define SCNiLEAST8   "hhi"
#define SCNiLEAST16  "hi"
#define SCNiLEAST32  "li"
#define SCNiLEAST64  "lli"

The macros each expand to a string literal suitable for use as an i scan conversion specificier, plus any needed qualifiers, to convert values of the types int_least8_t, int_least16_t, int_least32_t, or int_least64_t, respectively. Note that the definitions shown here are merely representative.

SCNiMAX

#define SCNiMAX   "lli"

The macro expands to a string literal suitable for use as an i scan conversion specificier, plus any needed qualifiers, to convert values of the types intmax_t. Note that the definition shown here is merely representative.

SCNiPTR

#define SCNiPTR   "lli"

The macro expands to a string literal suitable for use as an i scan conversion specificier, plus any needed qualifiers, to convert values of the types intptr_t. Note that the definition shown here is merely representative.

SCNo8, SCNo16, SCNo32, SCNo64

#define SCNo8     "hho"
#define SCNo16    "ho"
#define SCNo32    "lo"
#define SCNo64    "llo"

The macros each expand to a string literal suitable for use as an o scan conversion specificier, plus any needed qualifiers, to convert values of the types uint8_t, uint16_t, uint32_t, or uint64_t, respectively. Note that the definitions shown here are merely representative.

SCNoFAST8, SCNoFAST16, SCNoFAST32, SCNoFAST64

#define SCNoFAST8    "hho"
#define SCNoFAST16    "ho"
#define SCNoFAST32    "lo"
#define SCNoFAST64   "llo"

The macros each expand to a string literal suitable for use as an o scan conversion specificier, plus any needed qualifiers, to convert values of the types uint_fast8_t, uint_fast16_t, uint_fast32_t, or uint_fast64_t, respectively. Note that the definitions shown here are merely representative.

SCNoLEAST8, SCNoLEAST16, SCNoLEAST32, SCNoLEAST64

#define SCNoLEAST8   "hho"
#define SCNoLEAST16  "ho"
#define SCNoLEAST32  "lo"
#define SCNoLEAST64  "llo"

The macros each expand to a string literal suitable for use as an o scan conversion specificier, plus any needed qualifiers, to convert values of the types uint_least8_t, uint_least16_t, uint_least32_t, or uint_least64_t, respectively. Note that the definitions shown here are merely representative.

SCNoMAX

#define SCNoMAX   "llo"

The macro expands to a string literal suitable for use as an o scan conversion specificier, plus any needed qualifiers, to convert values of the types uintmax_t. Note that the definition shown here is merely representative.

SCNoPTR

#define SCNoPTR   "llo"

The macro expands to a string literal suitable for use as an o scan conversion specificier, plus any needed qualifiers, to convert values of the types uintptr_t. Note that the definition shown here is merely representative.

SCNu8, SCNu16, SCNu32, SCNu64

#define SCNu8     "hhu"
#define SCNu16    "hu"
#define SCNu32    "lu"
#define SCNu64    "llu"

The macros each expand to a string literal suitable for use as a u scan conversion specificier, plus any needed qualifiers, to convert values of the types uint8_t, uint16_t, uint32_t, or uint64_t, respectively. Note that the definitions shown here are merely representative.

SCNuFAST8, SCNuFAST16, SCNuFAST32, SCNuFAST64

#define SCNuFAST8    "hhu"
#define SCNuFAST16    "hu"
#define SCNuFAST32    "lu"
#define SCNuFAST64   "llu"

The macros each expand to a string literal suitable for use as a u scan conversion specificier, plus any needed qualifiers, to convert values of the types uint_fast8_t, uint_fast16_t, uint_fast32_t, or uint_fast64_t, respectively. Note that the definitions shown here are merely representative.

SCNuLEAST8, SCNuLEAST16, SCNuLEAST32, SCNuLEAST64

#define SCNuLEAST8   "hhu"
#define SCNuLEAST16  "hu"
#define SCNuLEAST32  "lu"
#define SCNuLEAST64  "llu"

The macros each expand to a string literal suitable for use as a u scan conversion specificier, plus any needed qualifiers, to convert values of the types uint_least8_t, uint_least16_t, uint_least32_t, or uint_least64_t, respectively. Note that the definitions shown here are merely representative.

SCNuMAX

#define SCNuMAX   "llu"

The macro expands to a string literal suitable for use as a u scan conversion specificier, plus any needed qualifiers, to convert values of the types uintmax_t. Note that the definition shown here is merely representative.

SCNuPTR

#define SCNuPTR   "llu"

The macro expands to a string literal suitable for use as a u scan conversion specificier, plus any needed qualifiers, to convert values of the types uintptr_t. Note that the definition shown here is merely representative.

SCNx8, SCNx16, SCNx32, SCNx64

#define SCNx8     "hhx"
#define SCNx16    "hx"
#define SCNx32    "lx"
#define SCNx64    "llx"

The macros each expand to a string literal suitable for use as an x scan conversion specificier, plus any needed qualifiers, to convert values of the types uint8_t, uint16_t, uint32_t, or uint64_t, respectively. Note that the definitions shown here are merely representative.

SCNxFAST8, SCNxFAST16, SCNxFAST32, SCNxFAST64

#define SCNxFAST8    "hhx"
#define SCNxFAST16    "hx"
#define SCNxFAST32    "lx"
#define SCNxFAST64   "llx"

The macros each expand to a string literal suitable for use as an x scan conversion specificier, plus any needed qualifiers, to convert values of the types uint_fast8_t, uint_fast16_t, uint_fast32_t, or uint_fast64_t, respectively. Note that the definitions shown here are merely representative.

SCNxLEAST8, SCNxLEAST16, SCNxLEAST32, SCNxLEAST64

#define SCNxLEAST8   "hhx"
#define SCNxLEAST16  "hx"
#define SCNxLEAST32  "lx"
#define SCNxLEAST64  "llx"

The macros each expand to a string literal suitable for use as an x scan conversion specificier, plus any needed qualifiers, to convert values of the types uint_least8_t, uint_least16_t, uint_least32_t, or uint_least64_t, respectively. Note that the definitions shown here are merely representative.

SCNxMAX

#define SCNxMAX   "llx"

The macro expands to a string literal suitable for use as an x scan conversion specificier, plus any needed qualifiers, to convert values of the types uintmax_t. Note that the definition shown here is merely representative.

SCNxPTR

#define SCNxPTR   "llx"

The macro expands to a string literal suitable for use as an x scan conversion specificier, plus any needed qualifiers, to convert values of the types uintptr_t. Note that the definition shown here is merely representative.

SCNX8, SCNX16, SCNX32, SCNX64

#define SCNX8     "hhX"
#define SCNX16    "hX"
#define SCNX32    "lX"
#define SCNX64    "llX"

The macros each expand to a string literal suitable for use as an X scan conversion specificier, plus any needed qualifiers, to convert values of the types uint8_t, uint16_t, uint32_t, or uint64_t, respectively. Note that the definitions shown here are merely representative.

SCNXFAST8, SCNXFAST16, SCNXFAST32, SCNXFAST64

#define SCNXFAST8    "hhX"
#define SCNXFAST16    "hX"
#define SCNXFAST32    "lX"
#define SCNXFAST64   "llX"

The macros each expand to a string literal suitable for use as an X scan conversion specificier, plus any needed qualifiers, to convert values of the types uint_fast8_t, uint_fast16_t, uint_fast32_t, or uint_fast64_t, respectively. Note that the definitions shown here are merely representative.

SCNXLEAST8, SCNXLEAST16, SCNXLEAST32, SCNXLEAST64

#define SCNXLEAST8   "hhX"
#define SCNXLEAST16  "hX"
#define SCNXLEAST32  "lX"
#define SCNXLEAST64  "llX"

The macros each expand to a string literal suitable for use as an X scan conversion specificier, plus any needed qualifiers, to convert values of the types uint_least8_t, uint_least16_t, uint_least32_t, or uint_least64_t, respectively. Note that the definitions shown here are merely representative.

SCNXMAX

#define SCNXMAX   "llX"

The macro expands to a string literal suitable for use as an X scan conversion specificier, plus any needed qualifiers, to convert values of the types uintmax_t. Note that the definition shown here is merely representative.

SCNXPTR

#define SCNXPTR   "llX"

The macro expands to a string literal suitable for use as an X scan conversion specificier, plus any needed qualifiers, to convert values of the types uintptr_t. Note that the definition shown here is merely representative.

strtoimax

intmax_t strtoimax(const char *restrict s, char **restrict endptr,
    int base);

The function converts the initial characters of the string s to an equivalent value x of type intmax_t. If endptr is not a null pointer, it stores a pointer to the unconverted remainder of the string in *endptr. The function then returns x. strtoimax converts strings exactly as does strtol.

If the string s does not match a valid pattern, the value stored in *endptr is s, and x is zero. If the equivalent value is too large to represent as type intmax_t, strtoimax stores the value of ERANGE in errno and returns either INTMAX_MAX, if x is positive, or INTMAX_MIN, if x is negative.

strtoumax

uintmax_t strtoumax(const char *restrict s, char **restrict endptr,
    int base);

The function converts the initial characters of the string s to an equivalent value x of type uintmax_t. If endptr is not a null pointer, it stores a pointer to the unconverted remainder of the string in *endptr. The function then returns x. strtoumax converts strings exactly as does strtoul.

If the string s does not match a valid pattern, the value stored in *endptr is s, and x is zero. If the equivalent value is too large to represent as type uintmax_t, strtoumax stores the value of ERANGE in errno and returns UINTMAX_MAX.

wcstoimax

intmax_t wcstoll(const wchar_t *restrict s, wchar_t **restrict endptr,
    int base);

The function converts the initial wide characters of the wide string s to an equivalent value x of type intmax_t. If endptr is not a null pointer, the function stores a pointer to the unconverted remainder of the wide string in *endptr. The function then returns x.

The initial wide characters of the wide string s must match the same pattern as recognized by the function strtol, with the same base argument, where each wide character wc is converted as if by calling wctob(wc)).

If the wide string s matches this pattern, wcstoimax converts strings exactly as does strtol, with the same base argument, for the converted sequence. If the wide string s does not match a valid pattern, the value stored in *endptr is s, and x is zero. If the equivalent value is too large in magnitude to represent as type intmax_t, wcstoimax stores the value of ERANGE in errno and returns either INTMAX_MAX, if x is positive, or INTMAX_MIN, if x is negative.

wcstoumax

uintmax_t wcstoumax(const wchar_t *restrict s,
     wchar_t **restrict endptr, int base);

The function converts the initial wide characters of the wide string s to an equivalent value x of type uintmax_t. If endptr is not a null pointer, the function stores a pointer to the unconverted remainder of the wide string in *endptr. The function then returns x.

The initial wide characters of the wide string s must match the same pattern as recognized by the function strtol, with the same base argument, where each wide character wc is converted as if by calling wctob(wc)).

If the wide string s matches this pattern, wcstoumax converts strings exactly as does strtol, with the same base argument, for the converted sequence. If the wide string s does not match a valid pattern, the value stored in *endptr is s, and x is zero. If the equivalent value is too large to represent as type uintmax_t, wcstoimax stores the value of ERANGE in errno and returns UINTMAX_MAX.


See also the Table of Contents and the Index.

Copyright © 1998-2002 by P.J. Plauger. All rights reserved.

[Previous] [Contents] [Next]