1.11.12. Format SpecifiersΒΆ

For printf and scanf you have to use predefined the following portable format specifiers:

Format Specifier

Corresponding RTS-Datatype

PRI_I8

RTS_I8

PRI_I16

RTS_I16

PRI_I32

RTS_I32

PRI_I64

RTS_I64

PRI_UI8

RTS_UI8

PRI_UI16

RTS_UI16

PRI_UI32

RTS_UI32

PRI_UI64

RTS_UI64

PRI_X8

RTS_X8

PRI_X16

RTS_X16

PRI_X32

RTS_X32

PRI_X64

RTS_X64

PRI_HANDLE

RTS_HANDLE

PRI_RESULT

RTS_RESULT

PRI_TIME

RTS_TIME

PRI_INT

RTS_INT

PRI_BOOL

RTS_BOOL

PRI_REAL32

RTS_REAL32

PRI_REAL64

RTS_REAL64

PRI_UINTPTR

RTS_UINTPTR

PRI_INTPTR

RTS_INTPTR

PRI_SIZE

RTS_SIZE

PRI_PTRDIFF

RTS_PTRDIFF

The same specifiers exists for scanf: SCN_xxx

In any printf you should use this portable specifiers.
For 64-Bit or the variable datatypes (like RTS_SIZE) you must use these specifiers in any case!

Usage:

RTS_I32 i32Counter;
printf("Counter: %" PRI_32 "\n", i32Counter);