失意高调,得意低调
分类: LINUX
2014-01-09 11:40:29
python中
sys.stdout = sys.__stdout__;
sys.stderr = sys.__stderr__;
c++中windows版为:
freopen( "CON", "w", stdout ); (参见链接)
linux应该为
freopen( "/dev/tty", "w", stdout );
#include#include void main(void) { FILE *stream ; if((stream = freopen("file.txt", "w", stdout)) == NULL) exit(-1); printf("this is stdout output/n"); stream = freopen("CON", "w", stdout); printf("And now back to the console once again/n"); }