Programmatically Ignore Cout

后端 未结 2 577
孤街浪徒
孤街浪徒 2021-01-04 17:57

Does anybody know if there is a trick to toggle all the cout << functions to not print out visible output? I am trying to hack together some code written

2条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-04 18:33

    Why precisely do you not want to redirect the output? If it is because there is other output you wish to keep, you may be out of luck.

    If it is just so you don't have to type a complex shell expression on a terminal in a demo, I suggest making a start script and doing the redirect inside.

    That, or reopen stdout to /dev/null somewhere near the top of main.

提交回复
热议问题