From: "John M. Aldrich" Newsgroups: comp.os.msdos.djgpp Subject: Re: C-style FILE IO problems.. Date: Fri, 20 Dec 1996 19:52:07 -0800 Organization: Two pounds of chaos and a pinch of salt Lines: 41 Message-ID: <32BB52F2.201B@cs.com> References: <59enik$foo AT news DOT luth DOT se> Reply-To: fighteer AT cs DOT com NNTP-Posting-Host: ppp106.cs.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: Roland Nilsson DJ-Gateway: from newsgroup comp.os.msdos.djgpp Roland Nilsson wrote: > > I've been using djgpp for a few months, and has experienced some > problems during heavy usage of C-style FILE io. It seems fread() > and fwrite() cannot handle reads of any size, they fail in certain > situations. I have not been able to find any logical pattern, they > just bomb sometimes. Are there any restrictions on FILE usage which > could explain this behaviour (maximum transfer sizes, reads at odd > positions, etc) ??? Make sure you aren't using fread()/fwrite() with binary data on files in text mode and then trying to use the data therefrom. Also, look in the FAQ section dealing with struct sizes and packing to make sure you aren't getting confused in the conversion from 16-bit code to 32-bit. Something else to consider: are you checking the exit status of fread() and fwrite() constantly? It's possible something other than file i/o is causing the trouble; you could be running out of file descriptors, overloading the transfer buffer, or any of a number of other things. If you can reduce your code to the shortest sample program that displays the erroneous behavior, and then post it here, we will be able to help you more. A sample run of your program with appropriate calls to perror() would also help. Finally, make sure you have DJGPP v2.01, which is the latest version, and that you aren't mixing programs from v2.01 and earlier versions. You may also wish to browse the current list of DJGPP bug reports at http://www.delorie.com/djgpp/bugs/ to see if anything there might contribute to your problem. Hope this helps... -- --------------------------------------------------------------------- | John M. Aldrich, aka Fighteer I | fighteer AT cs DOT com | | Proud owner of what might one | http://www.cs.com/fighteer | | day be a spectacular MUD... | Plan: To make Bill Gates suffer | ---------------------------------------------------------------------