Possible Duplicate:
Redirecting cout to a console in windows
I've created a child richedit window with CreateWindow
and I wonder is it possible to redirect all cout calls so text would appear in RichEdit controll instead of console ?
Possible Duplicate:
Redirecting cout to a console in windows
I've created a child richedit window with CreateWindow
and I wonder is it possible to redirect all cout calls so text would appear in RichEdit controll instead of console ?
As far as I know, you can't do that. You need to send window messages to set the text in the control.
That's not to say you can't use stream syntax. You could define your own ostream
and use that instead of cout
, then pass bytes into your window. It wouldn't help with any output that you don't generate, nor would it help if you mix printf
calls (which you shouldn't really do).