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

Unbuffered basic_streambuf Implementation

Is this even possible? I've found some references to specific "unbuffered"
type methods that exist in older incarnations of basic_streambuf but not in
newer ones.

Info please. :P
Jul 22 '05 #1
1 2846

<ye**@twenty.net> wrote in message news:EJeYc.54284$S55.26683@clgrps12...
Is this even possible? I've found some references to specific "unbuffered"
type methods that exist in older incarnations of basic_streambuf but not in
newer ones.


It's easy to write a stream buffer which performs unbuffered output. Simply
refrain from using the put-area pointer manipulation function setp, etc., and
override overflow (and possibly xsputn) to write directly to the underlying data
sink.

For input, you need a small buffer to support peeking at the next character
without consuming it and putting back a character that has already been
consumed.

Angelika Langer and Kluas Kreft present an unbuffered streambuf implementation
in their text 'Standard C++ Iostreams and Locales', p. 299. Their implementation
uses a buffer of size 1. I believe I found that this implementation does not
work with STLPort, which routinely peeks at the next character internally so
that the putback buffer is always full. So for 'unbuffered' input I always use a
buffer of size at least 2.

I have written an iostreams library which makes it easy to define new streams
and stream buffers. It's up for review for includion in Boost right now. I
encourage anyone who is interested to participate in the review process on the
Boost developers list (see http://www.boost.org/more/mailing_lists.htm#main).

Jonathan
Jul 22 '05 #2

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

Similar topics

5
by: Rich | last post by:
Does anyone know the correct way of opening an unbuffered output file using STL? I attempted: ofstream myfile("fname.txt", ios::binary); myfile.setbuf(NULL, 0); and I was informed that...
3
by: | last post by:
I can not seem to get this to compile with either gcc 3.4 or MSVC++ .NET 2003... (source follows first): ---= BEGIN MyStreamBuffer.h =--- // #IFDEF redundancy left out. #include <streambuf> ...
0
by: | last post by:
I was hoping that someone (after my own failures) might post a very mininal unbuffered derivation of basic_streambuf. My problem is that (even leaving the buffer pointers to their defaults) uflow()...
3
by: Steven T. Hatton | last post by:
I'm a bit confused about a statement in TC++ST §13.10. It's in reference to this example: /* The following code example is taken from the book * "The C++ Standard Library - A Tutorial and...
11
by: Lonnie Princehouse | last post by:
>From the cmd shell on both Windows 2k and XP, I'm getting this weird syntax error in conjunction with the unbuffered flag. It works fine without -u. Has anyone else encountered it? This didn't...
4
by: pank7 | last post by:
hi everyone, I have a program here to test the file IO(actually output) with buffer turned on and off. What I want to see is that there will be obvious differece in time. Here I have an input...
2
by: sri | last post by:
Dear All, I would like to implement file buffer class to make avialable buffering mechanism to ifstream or own customized file stream. My question is what are the semantics for seekoff,...
1
by: Yang Zhang | last post by:
Hi, is there any way to get unbuffered stdout/stderr without relying on the -u flag to python or calling .flush() on each print (including indirect hacks like replacing sys.stdout with a wrapper...
8
by: zeeshan708 | last post by:
what is the difference between the buffered and unbuffered stream ??(e.g we say that cout is buffered and cerr is unbuffered stream) does that mean that the output sent to buffered stream have to go...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.