|
|
basic_streambuf question
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 ]
|
|
0
|
|
|
|
Reply
|
srinivasarao_moturu (13)
|
4/5/2007 6:13:53 PM |
|
"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 ]
|
|
0
|
|
|
|
Reply
|
pjp (713)
|
4/5/2007 10:25:27 PM
|
|
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 ]
|
|
0
|
|
|
|
Reply
|
cbarron413 (16)
|
4/6/2007 2:37:49 AM
|
|
|
2 Replies
20 Views
(page loaded in 0.102 seconds)
|
|
|
|
|
|
|
|
|