Bug 13065 – writeln doesn't print the whole fixed size array of chars in some cases

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2014-07-07T09:25:00Z
Last change time
2014-07-07T11:14:37Z
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2014-07-07T09:25:03Z
void main() { import std.stdio: writeln; char[10] buf = 'X'; buf[5] = '\0'; writeln(buf); writeln("", buf); } Output: XXXXX XXXXX XXXX Expected Output: XXXXX XXXX XXXXX XXXX
Comment #1 by bearophile_hugs — 2014-07-07T09:28:13Z
I am using dmd 2.066beta1.
Comment #2 by andrej.mitrovich — 2014-07-07T10:39:52Z
Isn't this a duplicate report? We already know writeln() uses printf behind-the-scenes for single-string arguments.
Comment #3 by bearophile_hugs — 2014-07-07T11:09:00Z
(In reply to Andrej Mitrovic from comment #2) > Isn't this a duplicate report? Do you remember (or can you find) the issue number this is a dupe of?
Comment #4 by safety0ff.bugz — 2014-07-07T11:10:30Z
Comment #5 by bearophile_hugs — 2014-07-07T11:14:37Z
(In reply to safety0ff.bugz from comment #4) > https://issues.dlang.org/show_bug.cgi?id=8730 Thank you, dupes happen. I didn't know of that bug. *** This issue has been marked as a duplicate of issue 8730 ***