InvalidMemoryOperationError from File.byLine()?

anonymous via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jun 2 15:16:50 PDT 2015


On Tuesday, 2 June 2015 at 21:43:45 UTC, Stiff wrote:
> So...in the meantime, I'll just pad my input I guess?

It's a mess and I'm not sure what works and what doesn't, but 
here are some options:

byLineCopy: Could be fine as it doesn't reuse any buffers.

readln without passing a buffer: as above.

readln with passing a buffer: Problematic, readln won't respect 
the boundaries of the buffer (issue 13856). But it may work ok, 
if you give its very own GC allocation.

byLine from git head: If you can build phobos from source, the 
InvalidMemoryOperationError doesn't seem to happen there anymore. 
readln is still problematic, though.


More information about the Digitalmars-d-learn mailing list