On Wed, 12 Jun 2013 13:58:45 -0400, Walter Bright
<newshou...@digitalmars.com> wrote:
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.
It is already. Why would you think it's not? The specific case being
discussed is when the file descriptor is invalid from the start.
-Steve