更新时间:2023-11-06 16:36:40
使用Microsoft和GNU的C标准库,64位数字有不同的类型前缀。在为多个平台构建时,您可以使用:
There are different type prefixes for 64-bit numbers with the C standard libraries from Microsoft and GNU. When building for multiple platforms, you may use:
unsigned long long val = 0x1234567890123456;
#ifdef _MSC_VER // Using Visual C/C++
sprintf(output, "%#16I64X", val);
#else
sprintf(output, "%#16llX", val);
#endif
有关使用多平台编辑的信息已发布作为对如何显示/打印十六进制小数的问题的评论使用C ++使用C ++在4个字节后使用空格分隔符的数字如何以特殊格式显示Hexa十进制数,如下例所示,后面有空格... [ ^ ]。