freopen 重定向至文件后恢复至终端

2019-04-04 15:48:32
This post is also available in English and alternative languages.
操作系统 标准输入输出设备
Windows CON
Linux /dev/tty

Windows

1
2
freopen("CON", "r", stdin);
freopen("CON", "w", stdout);

Linux

1
2
freopen("/dev/tty", "r", stdin);
freopen("/dev/tty", "w", stdout);
Prev
2019-04-04 15:48:32
Next