How to disable cout output in the runtime?

前端 未结 5 1126
臣服心动
臣服心动 2020-12-14 08:52

I often use cout for debugging purpose in many different places in my code, and then I get frustrated and comment all of them manually.

Is there a way

5条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-14 08:53

    It seems you print debug messages. You could use TRACE within Visual C++/MFC or you just might want to create a Debug() function which takes care of it. You can implement it to turn on only if a distinct flag is set. A lot of programs use a command line parameter called verbose or -v for instance, to control the behavior of their log and debug messages.

提交回复
热议问题