Xref: utzoo comp.sys.ibm.pc.programmer:599 alt.msdos.programmer:1420 Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uwm.edu!rpi!zaphod.mps.ohio-state.edu!mips!apple!agate!darkstar!ucscb.UCSC.EDU!mee From: mee@ucscb.UCSC.EDU (Kevin Kahl) Newsgroups: comp.sys.ibm.pc.programmer,alt.msdos.programmer Subject: Re: Problem with disk full in programs compiled with Turbo-C Summary: Got a fix! Message-ID: <2132@darkstar.ucsc.edu> Date: 27 Mar 90 13:01:42 GMT References: <5705@ncsugn.ncsu.edu> Sender: usenet@darkstar.ucsc.edu Reply-To: mee@ucscb.UCSC.EDU (Kevin Kahl) Followup-To: comp.sys.ibm.pc.programmer Organization: UCSC Open Access Lines: 23 In article <5705@ncsugn.ncsu.edu> emigh@ncsugn.UUCP (Ted H. Emigh) writes: >I am using Turbo-C (Version 2.0), and am having trouble determining if the >disk is full. I have tried the obvious (at least to me obvious): >1) Code fragment: > result=fprintf(...) > if(result==EOF) { do something} > > result always returns the number of characters -- even if the disk > is full. There is disk activity, but nothing is written (obviously). Indeed! The result returned always is the number of bytes you attempted to write. This is probably a bug. Here is a workaround: fprintf(...); result = ferror(filehandle); if (result != 0) { do error handling} The ferror() routine returns 16 when the disk is full on my system. Hope this helps! -Kevin Kahl mee@ucscb.ucsc.edu