July 09, 2004
From the docs...

#   void fwritef(FILE* fp, ...);
#       Same as writef, but output is sent to the stream fp instead of stdout.

Shouldn't Phobos be encouraging the use of std.stream?

Shouldn't Phobos be discouraging the use of fopen(), and other C wrappers where sufficient or better D functionality exists?

I don't want to percieve D as a convenient way to call C functions. fopen() is
not OO and it is not safe. The stream does not close if an exeception is thrown
between fopen() and fclose(). It is possible to forget to call fclose().
fclose() will crash if you call it twice. I humbly suggest that fwritef() be
removed, and re-inserted as a member function of std.stream.

Jill



July 09, 2004
"Arcane Jill" <Arcane_member@pathlink.com> wrote in message news:cclipj$1imt$1@digitaldaemon.com...
> From the docs...
>
> #   void fwritef(FILE* fp, ...);
> #       Same as writef, but output is sent to the stream fp instead of
stdout.
>
> Shouldn't Phobos be encouraging the use of std.stream?
>
> Shouldn't Phobos be discouraging the use of fopen(), and other C wrappers
where
> sufficient or better D functionality exists?
>
> I don't want to percieve D as a convenient way to call C functions.
fopen() is
> not OO and it is not safe. The stream does not close if an exeception is
thrown
> between fopen() and fclose(). It is possible to forget to call fclose().
> fclose() will crash if you call it twice. I humbly suggest that fwritef()
be
> removed, and re-inserted as a member function of std.stream.

I wrote std.format.doFormat() so it could be hooked up to anything - both
FILE*'s and streams, as well as generating formatted strings. See
std.string.format() for the latter.