OPENFILE · READFILE · WRITEFILE · CLOSEFILE · EOF() · Text vs Binary Files
| Mode | Behaviour |
|---|---|
| READ | Open existing file to read; file pointer at start |
| WRITE | Create new file OR overwrite existing file completely |
| APPEND | Open existing file; file pointer at END; adds new data after existing content |
OPENFILE "scores.txt" FOR READ — correct syntax for opening in READ mode.WHILE NOT EOF("scores.txt") DO with READFILE "scores.txt", Line and OUTPUT Line inside the loop, terminated by ENDWHILE.CLOSEFILE "scores.txt" after the loop — must close the file when done.