b***i 发帖数: 3043 | 1 I want to use cout or cerr to output something in debug mode, but not
release mode
one way is to
#define myout cout
and use myout always when debug and change the definiton to some null file.
Is there a way to dynamically change the myout if it's declared as
ofstream myout;
such as, myout=cout; (this wouldn't work)
thanks. | t****t 发帖数: 6806 | 2 you can use
ostream& myout=cout;
but you can't change it. if you want to change it, use another scope.
【在 b***i 的大作中提到】 : I want to use cout or cerr to output something in debug mode, but not : release mode : one way is to : #define myout cout : and use myout always when debug and change the definiton to some null file. : Is there a way to dynamically change the myout if it's declared as : ofstream myout; : such as, myout=cout; (this wouldn't work) : thanks.
|
|