Unbuffered basic_streambuf Implementation

Discussion in 'C++' started by Guest, Aug 29, 2004.

  1. Guest

    Guest Guest

    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
    Guest, Aug 29, 2004
    #1
    1. Advertising

  2. <> 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
    Jonathan Turkanis, Aug 29, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Guest
    Replies:
    3
    Views:
    715
    John Harrison
    Aug 8, 2004
  2. Guest
    Replies:
    0
    Views:
    391
    Guest
    Aug 28, 2004
  3. Steven T. Hatton

    I/O std::basic_streambuf put and get areas?

    Steven T. Hatton, Jul 3, 2005, in forum: C++
    Replies:
    3
    Views:
    518
    Steven T. Hatton
    Jul 4, 2005
  4. sri
    Replies:
    2
    Views:
    347
    Carl Barron
    Apr 6, 2007
  5. Christopher
    Replies:
    1
    Views:
    405
    Christopher Pisz
    Jan 29, 2008
Loading...

Share This Page