Testing I/O success (Was: Portable Self-Replicating C Contest)

Siebren van der Zee siebren at cwi.nl
Mon Apr 10 21:21:26 AEST 1989


In article <12593 at haddock.ima.isc.com> karl at haddock.ima.isc.com (Karl Heuer) writes:
>Note rule 3.  Output calls can fail (e.g. disk full); the program must detect
>this condition and return the value EXIT_FAILURE to the execution environment.
>This constant is defined in <stdlib.h>, which must therefore be included.

You *CANNOT* detect disk-full always on unix, since I/O is lazy.
The last block of a file may be written to disk after the program
has exited.  As far as the contest (and _ANY_ serious program) is
concerned, you still have to check whatever you can, of course.

>Karl W. Z. Heuer (ima!haddock!karl or karl at haddock.isc.com), The Walking Lint

	Siebren van der Zee, siebren at cwi.nl



More information about the Comp.std.c mailing list