ostream which uses my own output method

Discussion in 'C++' started by Johannes Zellner, Feb 20, 2006.

  1. Hello,

    I need an ostream, which has all the operators like
    operator << (double)
    operator << (char*)
    etc ...
    but which actually calls my own write(char*) method to output
    the (possibly converted) characters. What is the simplest way
    to do this?

    --
    Johannes
     
    Johannes Zellner, Feb 20, 2006
    #1
    1. Advertising

  2. Johannes Zellner wrote:
    > but which actually calls my own write(char*) method to output
    > the (possibly converted) characters. What is the simplest way
    > to do this?


    You need to derive a class from 'std::streambuf', overload the
    'overflow()' and 'sync()' methods, and create an 'std::eek:stream'
    using this stream buffer. I have provided detailed descriptions
    of how to do this in past and I'm to bored to write it yet again.
    --
    <mailto:> <http://www.dietmar-kuehl.de/>
    <http://www.eai-systems.com> - Efficient Artificial Intelligence
     
    Dietmar Kuehl, Feb 20, 2006
    #2
    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. Replies:
    3
    Views:
    336
    Chris Uppal
    Mar 10, 2006
  2. Parity
    Replies:
    2
    Views:
    396
    Stephen Howe
    Aug 13, 2003
  3. Replies:
    3
    Views:
    469
    Dietmar Kuehl
    Jan 18, 2005
  4. Replies:
    2
    Views:
    1,977
  5. , India
    Replies:
    3
    Views:
    2,976
    James Kanze
    Nov 13, 2010
Loading...

Share This Page