Topic: basic_streambuf question
Author: "sri" <srinivasarao_moturu@yahoo.com>
Date: Thu, 5 Apr 2007 11:13:53 CST Raw View
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, overflow, and
underflow.
When I see MS VC++6.0 STL code's basic_filebuf implementation, I
observed that it is not maintaining any buffering mechanism, instead
it is directly handling with the files. Please correct me if I am
understanding in a wrong way.
Sincerely,
Sri
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]
Author: "P.J. Plauger" <pjp@dinkumware.com>
Date: Thu, 5 Apr 2007 15:25:27 CST Raw View
"sri" <srinivasarao_moturu@yahoo.com> wrote in message
news:1175789323.390444.258840@l77g2000hsb.googlegroups.com...
> 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, overflow, and
> underflow.
> When I see MS VC++6.0 STL code's basic_filebuf implementation, I
> observed that it is not maintaining any buffering mechanism, instead
> it is directly handling with the files. Please correct me if I am
> understanding in a wrong way.
That's correct. The code for overflow/underflow/uflow effectively
emulates the getc/putc macros in <stdio.h>, reaching directly into
the FILE buffers. Thus, there's a single buffering mechanism that's
shared between C and C++ I/O. (No need to disable sync_with_stdio
to get good throughput.)
P.J. Plauger
Dinkumware, Ltd.
http://www.dinkumware.com
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]
Author: Carl Barron <cbarron413@adelphia.net>
Date: Thu, 5 Apr 2007 19:37:49 CST Raw View
In article <1175789323.390444.258840@l77g2000hsb.googlegroups.com>, sri
<srinivasarao_moturu@yahoo.com> wrote:
> uld 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, overflow, and
> underflow.
Simplified for buffered streambufs
the protected virtual functions seekoff,underflow, overflow [and uflow]
perform the actual IO from device to buffer.
seekoff() does a relative seek similiar to fseek(),
underflow reloads buffer and returns the current char.
overflow empties the buffer and places the argument in the emptied
buffer.
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]