[comp.lang.c] I/O buffer size using lattice-C

lee@A60.UUCP (G. Lee) (12/29/86)

  Can anyone tell me how to increase the default buffer size in Lattice-C
from 512 bytes to N bytes when reading from a text file?
Thanks in advance.

-- 
Gene Lee           UUCP: ...ihnp4!{meccts,dayton,rosevax}!ems!A60!lee
Sperry Corporation     ATT:  (612) 635-6334

holtz@sdcsvax.UCSD.EDU (Harold Holtz III) (01/07/87)

There are two ways to change buffer sizes in Lattice C:

1.  Set the external int _bufsiz to the size you want BEFORE issuing the
    fopen.  It would be wise to change constant BUFSIZ in stdio.h to the
    value most commonly used.  This method should work in both V2 and V3.
    (_bufsiz supposedly defaults to BUFSIZ, but don't believe it; set it
    before using fopen to guarantee success)

2.  In V3 only:  use the setvbuf function described on page F-281 of the
    second volume of the V3 ref.  This has several advantages;  see the
    manual for details,  but beware the caution on F-283.  This call is
    done AFTER the fopen.

Fred Holtz
holtz@beowulf.UCSD.EDU