Range violation error when reading from a file
lithium iodate
whatdoiknow at doesntexist.net
Sun Jun 16 23:55:41 UTC 2019
On Sunday, 16 June 2019 at 23:44:49 UTC, Samir wrote:
> On Sunday, 16 June 2019 at 23:03:04 UTC, aliak wrote:
>
>> stripping the last line could result in an empty line if it
>> just has strippable characters?
>
> The last line of the file is just text but without a newline
> (\n) character or any other whitespace character at the end. I
> get the same error when I remove the strip function from the
> readln line.
There is *very* likely to be a terminating new-line at the end of
the file (many editors add one without asking!). If that the
case, the last line seen by the loop will be empty and you must
not attempt to access any elements.
More information about the Digitalmars-d-learn
mailing list