由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - ofstream and cout question
相关主题
c++ template中如何判断类型C++ Q13: Input
ostream& operator << (ostream& s, int cnt) errorabout namespace
C++ problemplease help debug this code
c++ template question:[C++ boost::interprocess] 讨论贴
C++重载<<错误?请教C++程序中的Maze().exitMaze();
在帮忙看看这个吧 C: int->char*请问关于overloading <<
partial_sort问题一个极简单的程序求教
请问一个入门级 dynamic memory 的问题fstream 扫盲,谢谢!
相关话题的讨论汇总
话题: myout话题: cout话题: ofstream话题: change话题: use
进入Programming版参与讨论
1 (共1页)
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.

1 (共1页)
进入Programming版参与讨论
相关主题
fstream 扫盲,谢谢!C++重载<<错误?
请问怎么让输出文件不需要成为函数的参数在帮忙看看这个吧 C: int->char*
Why no output file generate? What is wrong?partial_sort问题
[合集] ofstream 无法使用binary mode的问题请问一个入门级 dynamic memory 的问题
c++ template中如何判断类型C++ Q13: Input
ostream& operator << (ostream& s, int cnt) errorabout namespace
C++ problemplease help debug this code
c++ template question:[C++ boost::interprocess] 讨论贴
相关话题的讨论汇总
话题: myout话题: cout话题: ofstream话题: change话题: use