473,396 Members | 1,712 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,396 software developers and data experts.

Custom output stream

>From reading countless posts here I seem to get the impression that to
roll your own output stream class, the minimum you would likely needed
to do would be to override the overflow() method, as it is apparently
the default action of sync() is to call overflow(EOF).

In my own testing under Linux with g++, it appears that it is the
sync() method that needs to be overridden, as it does not appear to
default to calling overflow(EOF)... but overflow() certainly appears to
default in calling sync() when it needs more room.

Is this a "bug" with g++, or have I been mistaken in my intepretation
of the general consensus here?

Aug 28 '06 #1
1 2665

"Derek" <on*****@gmail.comskrev i meddelandet
news:11*********************@75g2000cwc.googlegrou ps.com...
From reading countless posts here I seem to get the impression that
to
roll your own output stream class, the minimum you would likely
needed
to do would be to override the overflow() method, as it is
apparently
the default action of sync() is to call overflow(EOF).
That is for basic_filebuf, but not for basic_streambuf. The filebuf is
possibly buffered, so it might need a sync() to force the buffer out
(to disk perhaps?).

Other streams might not be buffered.
>
In my own testing under Linux with g++, it appears that it is the
sync() method that needs to be overridden, as it does not appear to
default to calling overflow(EOF)... but overflow() certainly appears
to
default in calling sync() when it needs more room.
At what level are you overriding?

In basic_streambuf, the default sync() does nothing, and overflow()
returns eof immediately. You must override whatever virtual functions
you need, to implement your special stream buffer. Exactly which ones
depends on what you are interfacing to.
>
Is this a "bug" with g++, or have I been mistaken in my
intepretation
of the general consensus here?
Not really.
Bo Persson
Aug 28 '06 #2

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

Similar topics

12
by: Matt Garman | last post by:
I'd like to create a "custom output facility". In other words, I want an object whose use is similar to std::cout/std::cerr, but offers more flexibility. Instead of simply writing the parameter...
2
by: news-server.cfl.rr.com | last post by:
All, please help! I have written a custom stream object that does compression. I am using the J# libraries to accomplish this, java.util.zip. For my application I am also using the TripleDES...
16
by: Bret Pehrson | last post by:
I've converted a non-trivial C++ library to managed, and get the following unhelpful linker error: Assignment.obj : error LNK2022: metadata operation failed (80131195) : Custom attributes are...
3
by: Paul | last post by:
I need a way of creating a custom file which can be downloaded by a user. The file needs to be customized pre user (ie serial number built in). Creating the file is no problem. The problem is how...
3
by: Dexter | last post by:
Hello all, I'm building a web custom control, but i hava a problem. In the Sub Render, i have a html code as output. All ok. I have a other class that has a function that return a image object,...
1
by: Damien | last post by:
Hi guys, I'm developing a custom control which essentially acts as a button control, so I'm calling AddStyleAttribute repeatedly on the output stream, then adding a few normal attributes, and...
2
by: Raf256 | last post by:
Hello, my custom streambuf works fine with output via << and with input via .get() but fails to input via >> or getline... any idea why? -------------------- A custom stream buffer (for...
2
by: Josh Naro | last post by:
I am writing a module that requires the entire output from a web app to perform its function. So, basically I need to be able to pull the entire output stream from the Response object. I've tried...
4
by: rakesh.usenet | last post by:
For a particular application of mine - I need a simulation of byte array output stream. * write data onto a stream * getback the contiguous content as an array later for network transport. ...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.