www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - spaces and zeros in writef int format.

Below, I show a program, along with its output.  The writef(%d) and
printf(%d) output differs (which may be okay).  But writef's output
is not consistent for (i<10) and (i>=10).  The printf version seems
to treat this as " %5.5d".  The writef version seems to format with
"%5.5d" (or "% 5.5d"?) for (i<10), but with "%05.5d" for > 10.

If printf() doesn't understand the " " flag described here:

http://www.digitalmars.com/d/std_format.html

. that's okay (and kind of expected... I think).  But for writef()
I think there is at least one bug, that i>10 should have ' '.

Kevin


#import std.stdio;
#import std.file;
#import std.string;

#int main()


















































Oct 05 2004