Strange behavior of read file

H. S. Teoh hsteoh at quickfur.ath.cx
Tue Aug 27 10:20:17 PDT 2013


On Tue, Aug 27, 2013 at 07:14:22PM +0200, Paul Jurczak wrote:
> Correction to my initial post:
> 
> I oversimplified the code example by snipping too much of context.
> Here is an example, which fails both on Windows and Linux:
> 
> module main;
> 
> import std.stdio, std.file, std.string, std.algorithm, std.range,
> std.datetime, std.conv, std.typetuple;
> 
> int e67_1(string fileName = r"67.txt") {
>    // Read triangle numbers from file.
>    int[][] cell;
> 
>    foreach (y, line; splitLines(cast(char[]) read(fileName))) {

Maybe try inserting a writeln just before the foreach to print out what
filename it's actually trying to read? Or try using File to open it and
see if you get the same error?

	auto f = File(fileName, "r");


T

-- 
Ignorance is bliss... until you suffer the consequences!


More information about the Digitalmars-d-learn mailing list