freopen stdout and console

前端 未结 3 848
梦如初夏
梦如初夏 2020-12-16 03:32

Given the following function:

freopen(\"file.txt\",\"w\",stdout);

Redirects stdout into a file, how do I make it so stdout redirects back i

3条回答
  •  -上瘾入骨i
    2020-12-16 04:11

    An alternate solution is:

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

    Per wikipedia "CON" is a special keyword which refers to the console.

提交回复
热议问题