Portable printf format specifier for 64 bit hexadecimal?
This question already has an answer here:
The PRIx64
macro in <inttypes.h>
is what you're looking for.
It's a string token, so you can use it as: fprintf(stdout, "answer = %"PRIx64"n", val);
Since you specify %llX
, you probably want uppercase; use: PRIX64
您可以使用头<inttypes.h>
定义的宏PRIx64
或PRIX64 (for unsigned uppercase hexadecimal integer )
。
上一篇: 平台格式没有警告