#include
int main()
{
FILE * file;
int fd;
int i;
file=fopen("hello","a");
fd=fileno(file);
i=0;
while(i++ < 10)
fputs("hello how are you\n",file);
write(fd,"hello ,finished\n",16);
}
结果如下:
hello ,finished
hello how are you
hello how are you
hello how are you
hello how are you
hello how are you
hello how are you
hello how are you
hello how are you
hello how are you
hello how are you
可见两个写函数互不干涉.
最后一个write不会导致系统先清除fputs的缓冲.
阅读(992) | 评论(0) | 转发(1) |