problem with fread/fwrite

Leslie Mikesell les at chinet.chi.il.us
Sat Nov 17 02:07:51 AEST 1990


In article <27633 at mimsy.umd.edu> chris at mimsy.umd.edu (Chris Torek) writes:

>[...] though I have not looked
>closer than determining that the SVR3 stdio was absolutely horrid
>inside)

It seems real strange to me that when you use setvbuf, the first
putc() will trigger a write() (on AT&T 3b2 & 386 SysVr3.2 anyway).
This kind of defeats the purpose of requesting the buffer, doesn't
it?

Anyway, the nicest thing about stdio is that you are not obligated
to use it.  The only thing difficult at all to do using your own
buffering is an equivalent to fprintf().  Has anyone built something
like sprintf that can be limited to a fixed buffer size and maintains
state so you can pick up where you quit on the last pass?  It might
return either the number of characters placed in the buffer (if they
all fit) or a negative number indicating the buffer was filled and you
need to call again to get the rest. 

Les Mikesell
  les at chinet.chi.il.us



More information about the Comp.lang.c mailing list