www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - writef format bug

reply nascent <jesse.phillips eagles.ewu.edu> writes:
At least I believe this is a bug.

writefln("%c", 's');

gives me a format exception.
Feb 20 2006
parent Derek Parnell <derek psych.ward> writes:
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
Feb 20 2006