By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,843 Members | 864 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,843 IT Pros & Developers. It's quick & easy.

redirecting cout to dialog window

P: n/a
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
Jul 22 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a

"Pawel Kruczynski" <kr**@op.pl> wrote in message
news:c8**********@news.onet.pl...
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
Jul 22 '05 #2

P: n/a

Użytkownik John Harrison <jo*************@hotmail.com> w wiadomo¶ci do grup
dyskusyjnych napisał:2h************@uni-berlin.de...

"Pawel Kruczynski" <kr**@op.pl> wrote in message
news:c8**********@news.onet.pl...
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


Thanks a lot John
Jul 22 '05 #3

P: n/a
> 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
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Jul 22 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.