writef format bug

Derek Parnell derek at psych.ward
Mon Feb 20 20:35:10 PST 2006


On Mon, 20 Feb 2006 20:10:28 -0800, nascent wrote:

> At least I believe this is a bug.
> 
> writefln("%c", 's');
> 
> gives me a format exception.

That is because '%c' is not a valid format specifier. 

See http://www.digitalmars.com/d/phobos/std_format.html for details.

Use '%s' instead and it will format your character as a string.

D's writefln is different to printf(). The format specifiers in D just tell
D how you want it formatted, not what datatype you are supplying. It knows
that already.

-- 
Derek
(skype: derek.j.parnell)
Melbourne, Australia
"Down with mediocracy!"
21/02/2006 3:32:16 PM



More information about the Digitalmars-d-bugs mailing list