[Tutor] Buffering in file.read()

Dave Kuhlman dkuhlman at rexx.com
Mon May 12 17:57:46 CEST 2008


Kent Johnson <kent37 <at> tds.net> writes:

> 
> Footnote 2.3 says, "Specifying a buffer size currently has no effect
> on systems that don't have setvbuf(). The interface to specify the
> buffer size is not done using a method that calls setvbuf(), because
> that may dump core when called after any I/O has been performed, and
> there's no reliable way to determine whether this is the case."
> 
> So whether that works will depend on what OS the OP is using.

And so, the next question is: Which OS's support setvbuf()?

I'm on Ubuntu GNU/Linux.  I do the following and I see:

~ [6] cd /usr/include/
/usr/include [7] grep setvbuf *.h
stdio.h:/* The possibilities for the third argument to `setvbuf'.  */
stdio.h:extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf,

So, some versions of Linux apparently have it.

And, for MS Windows, you might look here:

    http://msdn.microsoft.com/en-us/library/86cebhfs(VS.80).aspx

So, MS Windows seems to support it.

- Dave



More information about the Tutor mailing list