🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.ibm.pc.programmer
Article #192

Re: Problem with disk full in programs compiled with Turbo-C

#192
From: Kevin Kahl
Date: Tue, 27 Mar 1990 13:01
23 lines
1394 bytes
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
Technical Details
Message-ID: <2132@darkstar.ucsc.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uwm.edu!rpi!zaphod.mps.ohio-state.edu!mips!apple!agate!darkstar!ucscb.UCSC.EDU!mee
References: <5705@ncsugn.ncsu.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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