The EOF function tests the specified file unit for the end-of-file condition.
Result = EOF(Unit)
If the file pointer is positioned at the end of the file, EOF returns true (1), otherwise false (0) is returned.
The file unit to test for end-of-file.
If file unit number 1 is open, the end-of-file condition can be checked by examining the value of the expression EOF(1). For example, the following IDL code reads and prints a text file:
; Open the file test.lis: OPENR, 1, 'test.lis' ; Define a string variable: A = '' ; Loop until EOF is found: WHILE ~ EOF(1) DO BEGIN ; Read a line of text: READF, 1, A ; Print the line: PRINT, ENDWHILE ; Close the file: CLOSE, 1