reddit discussion on replacing Python in 0install
"Jérôme M. Berger"
jeberger at free.fr
Wed Jun 12 10:36:17 PDT 2013
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:jeberger at free.fr
http://jeberger.free.fr
Jabber: jeberger at jabber.fr
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20130612/aad865e6/attachment.pgp>
More information about the Digitalmars-d
mailing list