441 shaares
38 private links
38 private links
Bon, pour les printfs en C:
#include <inttypes.h>
#define PRIu8 "hu"
#define PRId8 "hd"
#define PRIx8 "hx"
#define PRIu16 "hu"
#define PRId16 "hd"
#define PRIx16 "hx"
#define PRIu32 "u"
#define PRId32 "d"
#define PRIx32 "x" // x -> number in hexadecimal
#define PRIu64 "llu" // or possibly "lu"
#define PRId64 "lld" // or possibly "ld"
#define PRIx64 "llx" // or possibly "lx"
Syntax | Description |
---|---|
%zu | size_t |
%d / %i | int |
%u | unsigned int |
%ld | long |
%lu | unsigned long |
%lld | long long |
%llu | unsigned long long |
%c | character |
%s | a string of characters |
%e | exponential floating-point number |
%f | floating-point number |
%0.2f | floating-point number (like 0.58) |
%o | octal number (base 8) |
%% | print a percent sign |
\% | print a percent sign |
- | - |
%hhn | unsigned char * |
Finalement, pourquoi on ne mets pas toujours PRIxxx
, ça serait plus explicite ...