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

操作系统 标准输入输出设备
Windows CON
Linux /dev/tty

Windows

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

Linux

freopen("/dev/tty", "r", stdin);
freopen("/dev/tty", "w", stdout);

CC BY-SA 4.0 freopen 重定向至文件后恢复至终端 by 小小泥娃的部落格 is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

发表评论

This site uses Akismet to reduce spam. Learn how your comment data is processed.