On Tuesday, 18 June 2019 at 01:15:54 UTC, Samir wrote:
On Monday, 17 June 2019 at 03:46:11 UTC, Norm wrote:
On Monday, 17 June 2019 at 00:22:23 UTC, Samir wrote:
Any suggestions on how to rectify?
You could change the IF to
`if(line.length > 0 && line[0] == '>')`
Thanks, Norm. That seemed to do the trick and fixed the error.
On Monday, 17 June 2019 at 11:25:01 UTC, aliak wrote:
On Monday, 17 June 2019 at 00:22:23 UTC, Samir wrote:
HOWEVER, the output is interesting. There IS a blank line
between the last line and the prompt:
That's because you're using write*ln*. So even though line is
empty, you still output a new line.
Curious. I am going to have to think about that for a bit as I
don't quite understand.
I mean this:
$ dmd -run readfile.d
1)
file.eof() == false
line = "> line 1"
writeln("lines 1" + \n);
2)
file.eof() == false
line = line 2
writeln("line 2" + \n);
3)
file.eof() == false
line = line 3
writeln("line 3" + \n);
4)
file.eof() == false
line = > line 4
writeln("> line 4" + \n);
5)
file.eof() == false
line = line 5
writeln("line 5" + \n);
6)
file.eof() == false
line = "" // empty since there're no lines left in file
writeln("" + \n); <-- this is your blank line
7)
file.eof() == true