Does D need a sscanf?

Anders F Björklund afb at algonet.se
Mon Apr 30 07:28:32 PDT 2007


Daniel Keep wrote:

>> I called mine "unformat", to match "format". Like writef / readf.
> 
> Mine's called parsef (although it should probably be just parse to match
> format), with a convenience function readfln (to match writefln, naturally.)

Not sure if it was mentioned in the post, but the crappy old code
should still be posted at http://www.algonet.se/~afb/d/stdio/

There you'll find the hack implementation of unFormat, as well as
readln/readfln/unformat/writeln/writefln/format and the others...

>> No regular expressions or templates or tuples back then, though.
> 
> I remember those days... huddled around a camp fire in a dark cave,
> eating freshly bludgeoned Dromaeosaurid... back before deodorant...

Good Old Rock. Nothing Beats Rock.

> Is it a problem that it doesn't use the same getc/ungetc interface?

Depends on what you want it do :-) I just wanted the reverse of writef.
But the lack of TypeInfo made it never work with GCC 3.3 anyway, just
like the current stream implementation of readf doesn't. So I left it.
Figured it wasn't meant to be, and that you should use printf/scanf...

--anders



More information about the Digitalmars-d mailing list