On Sat, 13 Dec 2014 05:15:08 +0000 earthfront via Digitalmars-d-learn <digitalmars-d-learn@puremagic.com> wrote:
> Am I using array incorrectly? no, you are using `.byLine` incorrectly. ;-) `.byLine` reuses it's internal buffer for each line, so you have to copy that buffer. like this: import std.array, std.stdio; void main () { // Converting to "array" borks the thing import std.algorithm : map; auto names = File("names.txt") .byLine!(char,char)(KeepTerminator.no, ',') .map!"a.idup" .array; foreach (name; names) writeln(name); }
signature.asc
Description: PGP signature