[Issue 6495] New: array(file.byLine()) is a problem
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Sun Aug 14 12:12:06 PDT 2011
    
    
  
http://d.puremagic.com/issues/show_bug.cgi?id=6495
           Summary: array(file.byLine()) is a problem
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: andrej.mitrovich at gmail.com
--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2011-08-14 12:12:05 PDT ---
I can use readText, but if I want to use the byLine range with a call to
array() to save the lines of a text I end up getting garbage (I know why):
auto file = File("foo.txt", "r");
auto lineBuff = array(file.byLine());
I don't know if it can be fixed, I mean array() is not to blame (it only
exhausts a range), and byLine reuses a char[] buffer to stay efficient. But it
looks like something that could be thought about.
As a workaround I can do:
lineBuff = readText(r"file.txt").splitLines;
So it's not a big issue, but I ran into it and hence this report.
-- 
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