473,378 Members | 1,621 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

ostream which uses my own output method

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
Feb 20 '06 #1
1 1198
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::ostream'
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:di***********@yahoo.com> <http://www.dietmar-kuehl.de/>
<http://www.eai-systems.com> - Efficient Artificial Intelligence
Feb 20 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Boris | last post by:
Is it possible to manipulate the std::ostream to prepend a string when performing output, e.g. // manipute std::cout to prepend "prefix " std::cout << "hallo" << std::endl; // results in...
4
by: Alexander Stippler | last post by:
Hi, The short story: I have to redirect stdout (not cout!!) to an ostream. How can I manage this? The long story: I use the NAGC numerics library with C++ and want to use its output routines...
9
by: Ingo Nolden | last post by:
Hi there, I am writing c++ for some months now. I think I know the language now, but not yet all the tricky things of stl. For a kernel which is not using mfc I am writing a serialization. For...
13
by: Bo Peng | last post by:
Dear list, I need to add "disable output" feature to a bunch of objects that output to ostream (or ofstream). The least intrusive way to do this is pass them ofstream("/dev/null") but this makes...
13
by: Peteroid | last post by:
These don't work (I'm using VS C++.NET 2005 Express with clr:/pure syntax): ostream& operator <<( ostream& output, String^ str ) { output << str ; //compile error return output ; } ...
2
by: Henning Hasemann | last post by:
My class looks very exactly like this (left out boring things): class Situation { public: // ... virtual void toStream(std::ostream& ostr) const; }; std::string Situation::toString() const...
6
by: silversurfer2025 | last post by:
Hello, I am currently trying to derive a class from ostream (which is giving output to my GUI), such that I can give my methods either std::cout or my own outputstream-class to be used as output...
1
by: AJG | last post by:
Hi there. I am using a library called SOCI that has a method to set a stream which it uses to log SQL queries. The signature is as follows: void setLogStream(std::ostream *s); This works great...
3
by: Thomas Lenz | last post by:
The code below should allow to use a comma instead of << with ostreams and include a space between two operands when comma is used. e.g. cout << "hello", "world", endl; should print the line...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.