Denis Koroskin wrote: > The best solution would be for writeln() to throw on use, and I > think it's fairly easy to implement: just flush once after using > the file descriptor for the first time, and throw if it fails. > > While it doesn't cover a case where file descriptor becomes > non-writable during the program lifetime, it covers the most > common case of file descriptor not being writable at all.
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
Jerome
--
mailto:[email protected]
http://jeberger.free.fr
Jabber: [email protected]
signature.asc
Description: OpenPGP digital signature
