ostream which uses my own output method

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?

Advertisements

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: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

Share This Page

Welcome to The Coding Forums!

Welcome to the Coding Forums, the place to chat about anything related to programming and coding languages.

Please join our friendly community by clicking the button below - it only takes a few seconds and is totally free. You'll be able to ask questions about coding or chat with the community and help others.
Sign up now!