|
|
发表于 2006-4-22 13:37:17
|
显示全部楼层
Post by samwang
[root@localhost c]# more exit.c
#include<unistd.h>
#include<stdio.h>
#include<unistd.h>
#include<stdlib.h>
main()
{
printf("output begin\n");
printf("content in buffer");
write(STDOUT_FILENO,"abc",4);
// _exit(0);
exit(0);
}
[root@localhost c]# ./a.out
output begin
abccontent in buffer[root@localhost c]# ./a.out > temp
[root@localhost c]# more temp
abc
content in buffer
[root@localhost c]#
为什么将a.out标准输出重定向到别的文件里后,output begin反而不能打印输出了?
在我的系统上没有发生这个问题。你最好再确认一下贴出的代码是否有误?
或者有条件的话,可以换个环境试试。 |
|