Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!ncar!midway!gargoyle!chinet!les From: les@chinet.chi.il.us (Leslie Mikesell) Newsgroups: comp.lang.c Subject: Re: problem with fread/fwrite Keywords: fread, fwrite, file pointers Message-ID: <1990Nov16.150751.7732@chinet.chi.il.us> Date: 16 Nov 90 15:07:51 GMT References: <13992@ulysses.att.com> <2677@cirrusl.UUCP> <27633@mimsy.umd.edu> Organization: Chinet - Public Access UNIX Lines: 22 In article <27633@mimsy.umd.edu> chris@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@chinet.chi.il.us