Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > redirecting cout to dialog window

Reply
Thread Tools

redirecting cout to dialog window

 
 
Pawel Kruczynski
Guest
Posts: n/a
 
      05-23-2004
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


 
Reply With Quote
 
 
 
 
John Harrison
Guest
Posts: n/a
 
      05-23-2004

"Pawel Kruczynski" <(E-Mail Removed)> wrote in message
news:c8qnvg$1at$(E-Mail Removed)...
> 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


 
Reply With Quote
 
 
 
 
Pawel Kruczynski
Guest
Posts: n/a
 
      05-23-2004

Użytkownik John Harrison <(E-Mail Removed)> w wiadomości do grup
dyskusyjnych napisał:(E-Mail Removed)...
>
> "Pawel Kruczynski" <(E-Mail Removed)> wrote in message
> news:c8qnvg$1at$(E-Mail Removed)...
> > 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


 
Reply With Quote
 
Prateek R Karandikar
Guest
Posts: n/a
 
      05-26-2004
> 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
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: cout vs std::cout Hendrik Schober C++ 7 10-07-2008 12:02 AM
Re: cout vs std::cout Stefan Ram C++ 7 09-30-2008 01:55 PM
can cout<<""; can cout<<""; contribute ? wangzhihuii@yahoo.com.cn C++ 4 09-15-2005 06:16 PM
std::cout vs cout Pmb C++ 2 06-02-2004 03:27 PM
man cout or info cout abi C++ 2 06-28-2003 06:42 PM



Advertisments