You will get exitcode 217 if the file named textfile.txt
does not exist in the same directory as the executable.
read(f,n);
will read the file into n
, up to the end-of-line. Then it will get stuck. You nedd a readLN
to read the newline.
Similarly, write(n);
will write n
to the console, but there will be no newline; you need writeln(n);
to add a newline.
It's not clear quite exactly what your file-structure is. Spaces are hard to see. If you use readln(f,n);
then n
will contain the content of the line read - and if you want to detect an empty line, then you need until n='';
, with no space between the quotes.
Since you don't supply seekEoLN
with a parameter, it works on the keyboard, not the file. You need seekEoln(f)
to find the end-of-line in the file.
Keep plugging away - you'll get there. I'd suggest you remove your seekEoln
s and take great care over whether you want to read an entire line (readln) or just a character (read)