红联Linux门户
Linux帮助

新手提问:大家帮帮看看这程序有什么问题,编译不通过

发布时间:2011-07-17 13:18:35来源:红联作者:jayee
/*4-4.c 获取“/etc/passwd”文件的大小*/
#include /*文件预处理,包含chmod函数库*/
#include /*文件预处理,包含chmod函数库*/
#include
int main () /*C程序的主函数,开始入口*/
{
struct stat buf;
stat("/etc/passwd",&buf);
printf("“/etc/passwd”文件的大小是:%d\n",buf.st_size);
return 0;
}
编译出现下面的问题,但新手表示不明白,求教:

4-4.c: In function ‘main’:
4-4.c:9:1: warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘__off_t’
文章评论

共有 2 条评论

  1. jayee 于 2011-07-18 01:39:50发表:

    2# whatot


    解决了,应该是以%ld输出

  2. whatot 于 2011-07-18 01:00:10发表:

    输出不应该是%d吧