libpcap 中调用ctime()时警告提示:

warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘int’ [-Wformat=]  
 例如: printf("%s", ctime((const time_t *)&protocol_header.ts.tv_sec));

加上ctime的头文件<time.h>就可以解决。

理由:在64位的Linux 下,int是32位的,而指针(在这里是 char *)是64位的。问题应该就是出在这里!
 
  同样的问题在用inet_ntoa()时也容易出现!!

posted @ 2016-06-20 21:06  soyosuyang  阅读(192)  评论(0编辑  收藏  举报