[Issue 8730] writeln stops on a nul character, even if passed a D string

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Oct 9 20:02:17 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8730



--- Comment #3 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2012-10-09 19:38:15 PDT ---
(In reply to comment #2)
> (In reply to comment #1)
> > The specialization is probably to blame. I think 'args[0].length' probably sets
> > the max limit rather than min, but I don't know enough about fprintf internals.
> > :)
> 
> 
> Yeah, you're right. The man page for printf says "the maximum number of
>        characters to be printed from a string for s and S conversions."
> 
> 
> I'm not sure what is best here. I really think it should work, but the
> specialization has got to be there for a reason too.

It could me off guard just recently. E.g. git uses two strings separated by nul
in it's object format, and when I've tried to print out the contents as a
char[] using writeln it would only print out a small portion of it, even though
printing it as a byte[] would print much more.

Anyway this *is* a bug. We can't have it both ways:
writeln("bla\0bla");  // bla
writefln("%s", "bla\0bla");  // bla[NUL]bla

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list