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

           Summary: Truncation of long string by std.stdio.write
           Product: D
           Version: 2.026
          Platform: PC
               URL: http://www.britseyeview.com/middle.txt
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: bugzi...@digitalmars.com
        ReportedBy: steve.te...@britseyeview.com


Walter,

The file middle.txt at the URL above has lines numbered up to 555. If I read it
into a string and std.stdio.write the string to the console, the output is
truncated at line 261.

import std.file;
import std.stdio;
import std.c.stdio;

void main()
{
   string s2 = cast(immutable(char[])) std.file.read("middle.txt");
   std.stdio.write(s2);
   printf("%s", (s2 ~ "\x00").ptr);
}

It isn't std.file.read, as I got similar behavior when the string was output to
the console from the program that generated middle.txt - then it was at line
221.

I checked the string for embedded zeroes and 0x1a when it was doing the fail at
221, but it seemed to be OK.

printf works as expected.

I'm sorry I can't come up with anything more compact than this, and I'm
probably missing something stupid.

Steve


-- 

Reply via email to