On Wednesday, 16 May 2018 at 07:06:45 UTC, Dennis wrote:
On Wednesday, 16 May 2018 at 02:47:50 UTC, Jon Degenhardt wrote:
Can you show the program you are using that throws when using byLine?

Here's a version that only outputs the first chunk:
```
import std.stdio;
import std.range;
import std.algorithm;
import std.file;
import std.exception;

void main(string[] args) {
        enforce(args.length == 2, "Pass one filename as argument");
auto lineChunks = File(args[1], "r").byLine.drop(4).chunks(10_000_000/10);
        new File("output.txt", "w").write(lineChunks.front.joiner);
}
```

If you write it in the style of my earlier example and use counters and if-tests it will work. byLine by itself won't try to interpret the characters (won't auto-decode them), so it won't trigger an exception if there are invalid utf-8 characters.

Reply via email to