Portable printf format specifier for 64 bit hexadecimal?

This question already has an answer here:

  • How to printf a 64-bit integer as hex? [duplicate] 2 answers

  • 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>定义的宏PRIx64PRIX64 (for unsigned uppercase hexadecimal integer )

    链接地址: http://www.djcxy.com/p/72222.html

    上一篇: 平台格式没有警告

    下一篇: 用于64位十六进制的便携式printf格式说明符?