测试下,发现不能打开,还不清楚是什么原因 #include <stdio.h> int main(int argc, char *argv[]){ printf("hello world, before fclose stdout\n"); fclose(stdout); stdout = fopen("/dev/tty", "w"); printf("hello world, after fclose stdout\n"); return 0; } 在X86_64bit Ubuntu下编译,第二个printf是不能打印出来的。
试试