Hi,

I'm trying to read a file line by line, and I get a core.exception.InvalidMemoryOperationError@(0), even after reducing the program to:

import std.stdio;

void main()
{
  File f = File("testfile");
  foreach(line; f.byLine)
  {
  }
}

The file is a simple table of ascii characters, 811 columns and it fails on the second line. Taking any subset of the columns and the program runs fine so I don't think it can by any particular file corruption.

In this simple example I can get it to work by changing:

foreach(line; f.byLine)

to

foreach(char[] line; f.byLine)

but in my more complicated program this still fails with the same error:

foreach (char[] lineVar; inFile.byLine)
{
  lineVar.split.indexed(places).joiner("\t").writeln;
}

(as does the range version I originally wrote:
inFile.byLine.map!(a => a.split.indexed(places).joiner("\t")).joiner("\n").writeln;)

Is this a bug, gdc on version 2.066 seems to have no problems with it? I'd be happy to fill in a bug report, but I can't share the file as it's sensitive genetic data and I haven't been able to reduce it to anything innocuous.

This has me very puzzled, any suggestions would be much appreciated.

Thanks very much

Andrew

Reply via email to