PRIu64宏—打印输出64位整型值

2014/04/14 09:55
阅读数 9.9K

先上例子:

#include <inttypes.h>
#include <stdio.h>
int main()
{
    uint64_t t = 111111111111111142;
    printf("1. %d\n",t);
    printf("2. %lu\n",t);
    printf("3. " "%" PRIu64 "\n", t);
    return 0;
}

(1)在VC10中,并没有<inttypes.h> 。

VC10中有一个<stdint.h>,其中定义了uint64_t,但没有定义PRIu64。

(2)在gcc中,<stdint.h>是包含在<inttypes.h>中的。

所以,上述的第三种方法,无法在VC中实现。在VC中,大家还是使用std::cout作为输出方式吧。



展开阅读全文
加载中
点击引领话题📣 发布并加入讨论🔥
0 评论
0 收藏
0
分享
返回顶部
顶部