; Eof Example ; ----------- ; Write a short captain's log to read back file=WriteFile("demo_log.txt") WriteLine file,"Day 1: Landed on the moon" WriteLine file,"Day 2: Found a strange crater" WriteLine file,"Day 3: It was cheese all along" CloseFile file ; Read the whole file - Eof returns 1 once every line has been read, ; so this loop copes with a file of any length file=ReadFile("demo_log.txt") count=0 While Not Eof(file) count=count+1 Print "Line "+count+": "+ReadLine$(file) Wend CloseFile file Print "Eof reached after "+count+" lines" ; Clean up the demo file DeleteFile "demo_log.txt" Print "Deleted demo_log.txt" Print "" Print "Press any key to close the example" WaitKey End