Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > ostream which uses my own output method

Reply
Thread Tools

ostream which uses my own output method

 
 
Johannes Zellner
Guest
Posts: n/a
 
      02-20-2006
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
 
Reply With Quote
 
 
 
 
Dietmar Kuehl
Guest
Posts: n/a
 
      02-20-2006
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.
--
<(E-Mail Removed)> <http://www.dietmar-kuehl.de/>
<http://www.eai-systems.com> - Efficient Artificial Intelligence
 
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
Strange compiler error w.r.t 'friend ostream& operator<< <>(ostream&,...)' abhay.burli@gmail.com C++ 2 02-26-2009 06:18 AM
help needed: defining my own ostream manipulators paul.wilkins@gmail.com C++ 3 01-18-2005 11:07 AM
Please help on ostream output error Zhixin Han C++ 4 10-07-2004 03:12 PM
function to format message & output to cerr/cout/ostream Trevor C++ 2 11-02-2003 11:51 PM
ostream value output question Parity C++ 2 08-13-2003 10:50 PM



Advertisments