Re: help! anyone knows how to improve STL multi-thread synch?
- From: Jason Winnebeck <gillius-ng2@xxxxxxxxxxxxxxxxxx>
- Date: Mon, 20 Feb 2006 09:31:17 -0500
Tom Widmer [VC++ MVP] wrote:
That is not the correct way to redirect cout. Instead, try:
int main()
{
std::filebuf fb;
fb.open("logfile.txt", std::ios_base::out);
std::streambuf* oldcout = std::cout.rdbuf(&fb);
// rest of program
//must reset before exit:
std::cout.rdbuf(oldcout);
}
Sorry for the side-question, but why does one need to reset the old rdbuf? Is it to prevent a memory leak?
Jason
.
- Follow-Ups:
- Re: help! anyone knows how to improve STL multi-thread synch?
- From: Ulrich Eckhardt
- Re: help! anyone knows how to improve STL multi-thread synch?
- References:
- help! anyone knows how to improve STL multi-thread synch?
- From: Zhang, Xiaowei
- Re: help! anyone knows how to improve STL multi-thread synch?
- From: Tom Widmer [VC++ MVP]
- help! anyone knows how to improve STL multi-thread synch?
- Prev by Date: Re: lexical_cast eating memory - or the STL
- Next by Date: Re: help! anyone knows how to improve STL multi-thread synch?
- Previous by thread: Re: help! anyone knows how to improve STL multi-thread synch?
- Next by thread: Re: help! anyone knows how to improve STL multi-thread synch?
- Index(es):
Relevant Pages
|