redirecting cout to dialog window

P

Pawel Kruczynski

did any know how redirect standard cout to edit in dialog window?
i work in ms vc++ and i don't want use mfc. please help..
sorry for my poor english
 
J

John Harrison

Pawel Kruczynski said:
did any know how redirect standard cout to edit in dialog window?
i work in ms vc++ and i don't want use mfc. please help..
sorry for my poor english

Write your own streambuf derived class that outputs to the dialog window.

Then use it like this (say your class is called MyBuffer)

MyBuffer my_buffer(...);
streambuf* old_buffer = cout.rdbuf(&my_buffer);
// cout will now be redirected to your dialog box
....
cout.rdbuf(old_buffer);
// now cout is back to normal

For details on how to write streambuf derived classes consult a good book on
the STL, for instance 'The C++ Standard Library' by Josuttis

john
 
P

Pawel Kruczynski

U¿ytkownik John Harrison said:
Write your own streambuf derived class that outputs to the dialog window.

Then use it like this (say your class is called MyBuffer)

MyBuffer my_buffer(...);
streambuf* old_buffer = cout.rdbuf(&my_buffer);
// cout will now be redirected to your dialog box
...
cout.rdbuf(old_buffer);
// now cout is back to normal

For details on how to write streambuf derived classes consult a good book on
the STL, for instance 'The C++ Standard Library' by Josuttis

john

Thanks a lot John
 
P

Prateek R Karandikar

did any know how redirect standard cout to edit in dialog window?
i work in ms vc++ and i don't want use mfc. please help..
sorry for my poor english

Standard C++ has no GUI, so there is no such thing as "dialog window"
in Standard C++.

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
To iterate is human, to recurse divine.
-L. Peter Deutsch
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top