printf and global namespace
Sean Kelly
sean at f4.ca
Fri Apr 28 09:13:35 PDT 2006
Anders F Björklund wrote:
>
> The only thing missing from "writef" is a fully implemented "readf",
> or perhaps a "write" version that works without the format characters.
There's an implementation here:
http://www.home.f4.ca/sean/d/
It could probably be improved as it uses dchars internally, but it's a
complete and correct implementation of scanf from the C99 spec plus some
additional support for D types. Throwing exceptions out of the function
could be accomplished easily by rethrowing from the appropriate catch
block at the bottom of unFormat. Please note that this currently
requires the updated utf module it contains, though I believe it could
be rewritten to grab a single char and use stride() to determine how
many more were expected--I wasn't aware of stride() when I wrote this
code a year or so ago. If there were real interest in getting this into
Phobos I could probably find the time to make any requested updates
myself, but I'm too busy to do so for any other reason.
Sean
More information about the Digitalmars-d
mailing list