redirecting cout to dialog window

Discussion in 'C++' started by Pawel Kruczynski, May 23, 2004.

  1. 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
    Pawel Kruczynski, May 23, 2004
    #1
    1. Advertising

  2. "Pawel Kruczynski" <> wrote in message
    news:c8qnvg$1at$...
    > 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
    John Harrison, May 23, 2004
    #2
    1. Advertising

  3. U¿ytkownik John Harrison <> w wiadomo¶ci do grup
    dyskusyjnych napisa³:...
    >
    > "Pawel Kruczynski" <> wrote in message
    > news:c8qnvg$1at$...
    > > 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
    Pawel Kruczynski, May 23, 2004
    #3
  4. > 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
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    Prateek R Karandikar, May 26, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. abi

    man cout or info cout

    abi, Jun 27, 2003, in forum: C++
    Replies:
    2
    Views:
    1,633
  2. Pmb

    std::cout vs cout

    Pmb, Jun 2, 2004, in forum: C++
    Replies:
    2
    Views:
    4,389
    Leor Zolman
    Jun 2, 2004
  3. Replies:
    4
    Views:
    307
    Howard
    Sep 15, 2005
  4. Stefan Ram

    Re: cout vs std::cout

    Stefan Ram, Sep 28, 2008, in forum: C++
    Replies:
    7
    Views:
    459
  5. Hendrik Schober

    Re: cout vs std::cout

    Hendrik Schober, Sep 28, 2008, in forum: C++
    Replies:
    7
    Views:
    423
    Jerry Coffin
    Oct 7, 2008
Loading...

Share This Page