On 6/12/2013 10:36 AM, "Jérôme M. Berger" wrote:
Actually, the best solution is to check if the file is writable before writing and *without flushing*. On Posix systems, this can be done with:fcntl (fd, F_GETFL) & W_OK
Sure, but that doesn't cover the case of a write failure because the disk is is near full and then is full.
The write has to be tested to see if it succeeded, not assumed to succeed because only one of the possible failure conditions is not present.