Size and Distance Specification (Windows CE 5.0)
Developing an Application > Microsoft C Run-time Library for Windows CE > Run-time Library Reference > printf, wprintf
The optional prefixes to type, h, l, and L, specify the "size" of argument (long or short, single-byte character or wide character, depending upon the type specifier that they modify).
These type-specifier prefixes are used with type characters in printf functions to specify interpretation of arguments, as shown in the following table. These prefixes are Microsoft extensions and are not ANSI-compatible.
Note The h, l, and L prefixes are Microsoft extensions when used with data of type char.
Size Prefixes for printf Format-Type Specifiers
To Specify | Use Prefix | With Type Specifier |
---|---|---|
long int | l | d, i, o, x, or X |
long unsigned int | l | u |
short int | h | d, i, o, x, or X |
short unsigned int | h | u |
__int64 | I64 | d, i, o, u, x, or X |
Single-byte character with printf functions | h | c or C |
Wide character with printf functions | l | c or C |
Single-byte – character string with printf functions | h | s or S |
Wide-character string with printf functions | l | s or S |
To print single-byte or wide-characters with printf functions, use format specifiers as follows.
To Print Character As | Use Function | With Format Specifier |
---|---|---|
single byte | printf | c, hc, or hC |
wide | printf | C, lc, or lC |
To print strings with printf functions, use the prefixes h and l analogously with format type-specifiers s and S.
Send Feedback on this topic to the authors