I am trying to write a Karel program that will read all existing lines in a .dt file.
Currently my .dt file has 3 lines, simply:
And I want to read all 3 lines with KAREL, this is my KAREL code:
It is almost working, but it is reading only the first line, when it attempts to read the second line I get the error:
Line 19 is the line with the WRITE statement, so on the second iteration of the loop, no data was read and tempString is empty, (im assuming), why is that?
What is the correct way to read all lines from a file?