www.delorie.com/djgpp/doc/libc/libc_623.html   search  
libc.a reference

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

PRI

Syntax

 
#include <inttypes.h>

Description

The PRI family of macros allows integers to be displayed in a portable manner using the printf family of functions (see section printf). They include a conversion qualifier, to specify the width of the type (e.g.: l for long), and the conversion type specifier (e.g.: d for decimal display of integers).

The PRI family of macros should be used with the types defined in the header <stdint.h>. For example: int8_t, uint_fast32_t, uintptr_t, intmax_t.

Below N can be 8, 16, 32 or 64. The PRI macros are:

PRIdN
PRIiN

The d and i type conversion specifiers for a type intN_t of N bits.

PRIdLEASTN
PRIiLEASTN

The d and i type conversion specifiers for a type int_leastN_t of N bits.

PRIdFASTN
PRIiFASTN

The d and i type conversion specifiers for a type int_fastN_t of N bits.

PRIdMAX
PRIiMAX

The d and i type conversion specifiers for a type intmax_t.

PRIdPTR
PRIiPTR

The d and i type conversion specifier for a type intptr_t.

PRIoN
PRIuN
PRIxN
PRIXN

The o, u, x and X type conversion specifiers for a type uintN_t of N bits.

PRIoLEASTN
PRIuLEASTN
PRIxLEASTN
PRIXLEASTN

The o, u, x and X type conversion specifiers for a type uint_LEASTN_t of N bits.

PRIoFASTN
PRIuFASTN
PRIxFASTN
PRIXFASTN

The o, u, x and X type conversion specifiers for a type uint_FASTN_t of N bits.

PRIoMAX
PRIuMAX
PRIxMAX
PRIXMAX

The o, u, x and X type conversion specifiers for a type uintmax_t.

PRIoPTR
PRIuPTR
PRIxPTR
PRIXPTR

The o, u, x and X type conversion specifiers for a type uintptr_t.

Return Value

Not applicable.

Portability

ANSI/ISO C C99; not C89
POSIX 1003.1-2001; not 1003.2-1992

Example

 
uintmax_t foo = 500;

printf("foo is %" PRIuMAX " in decimal and 0x%" PRIxMAX " in hex.\n",
       foo, foo);


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2004   by DJ Delorie     Updated Apr 2004