From: <dan...@ya...> - 2003-05-15 21:17:59
|
--- Andy Ross <an...@pl...> wrote: > Benjamin Riefenstahl wrote: > > Andy Ross writes: > > > until I discovered that the MS fread() implementation almost always > > > returns short reads on disk files. > > > > I'm rather skeptical here but curious. Can you give a testcase? > > stat() the file to get the size, allocate a buffer, fopen(), fread(). > The files in question were 20-60k in size, and the read would > typically return only 2-3 pages worth at a time. I got the behavior > to happen (under XP) on the local disk and from a share mounted from > Samba. Using the win32 CreateFile/ReadFile APIs on exactly the same > files worked as documented. > > I don't think this is strictly a bug. The SUSv3 spec requires that > fread() return a short count only on error or eof, but I couldn't find > equivalent language in the ANSI C standard. It's enough of an > annoyance, though, that doing the win32 port was preferable to testing > on all platforms or writing a read loop. > Thanks! You've just given me a major hint on why libstdc++'s fstream is sometimes screwing up. Danny > Andy > > -- > Andrew J. Ross Beyond the Ordinary Plausibility Productions > Sole Proprietor Beneath the Infinite Hillsboro, OR > Experience... the Plausible? > > > > > ------------------------------------------------------- > Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara > The only event dedicated to issues related to Linux enterprise solutions > www.enterpriselinuxforum.com > > _______________________________________________ > MinGW-users mailing list > Min...@li... > > You may change your MinGW Account Options or unsubscribe at: > https://lists.sourceforge.net/lists/listinfo/mingw-users http://mobile.yahoo.com.au - Yahoo! Mobile - Check & compose your email via SMS on your Telstra or Vodafone mobile. |