LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 534|回复: 0

奇怪,求助,在redhat adv3中编译遇到的问题

[复制链接]
发表于 2003-11-21 12:06:55 | 显示全部楼层 |阅读模式
fstat函数运行不正常,如下函数所示,在redhat 9中编译运行最后打印值是5,但是在redhat adv3 中编译运行时总是零,请问fstat函数用不了是由于什么方面的问题,如何解决,谢谢。
另不知发文是不是发错了版面,如果发错了实在抱歉。

#include <sys/types.h>
#include <unistd.h>
#include <sys/stat.h>
main()
{
int fd[2];
int writenum;
struct stat statbuf;
if( pipe(fd)<0)
      perror("pipe message");
writenum=write(fd[1],"hello",5);
if(writenum==-1)
   perror("the write:");
printf("the writenum:%d\n",writenum);
fstat(fd[0],&statbuf);
printf("the size:%d,\n",statbuf.st_size);
}
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表