gabriel rosenkoetter on Wed, 28 Nov 2001 03:00:24 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] c++ fs calls


On Tue, Nov 27, 2001 at 07:12:12PM -0500, Walt Mankowski wrote:
> The biggest minus for read() and write() is that they're unbuffered.
> Streams accessed through the stdio.h calls are buffered by default.
> setbuf(3) and friends are used to change the buffering.

Um, sure, but read(2) blocks on input. Buffering's not really an
issue unless you're reading from a file someone else is writing to
(which includes pipes and sockets), and it's *really* easy to do
buffering yourself.

Also, imho, write(2) takes the right approach; it doesn't buffer
(meaning you know what went through) and returns the number of bytes
it was able to write, making it really easy to resend what you need
to resend.

Anyway, maybe the QT stuff will serve the original poster best
especially since he's already linking with it, but if you're rolling
your own stuff and don't want the overhead, but do want the
applicability to any file descriptor you throw at it, read/write(2)
are the thing.

-- 
       ~ g r @ eclipsed.net

Attachment: pgp97625QJu0E.pgp
Description: PGP signature