EOF Function
Tests the specified file unit for the end-of-file condition.
Usage
result = EOF(unit)
Input Parameters
unit—The logical unit number (LUN) of the file to be tested.
Returned Value
result—Returns 1 if the file is positioned at the end of the file. Otherwise, returns 0.
Keywords
None.
Discussion
None.
Example
In this example, a file of test data is created. That file is then read and printed until the end-of-file condition is detected by EOF.
; Open the file eoffile.dat for writing.
OPENW, unit, 'eoffile.dat', /Get_Lun
 
; Write some text to the file.
PRINTF, unit, 'This is'
PRINTF, unit, 'some sample'
PRINTF, unit, 'data.'
; Close the file and free the associated unit number.
FREE_LUN, unit
; Open the file eoffile.dat for reading.
OPENR, unit, 'eoffile.dat', /Get_Lun
; Define a string variable.
a = ' ' 
; Read data and print it until end-of-file.
WHILE NOT EOF(unit) DO BEGIN &$
   READF, unit, a &$
   PRINT, a &$
ENDWHILE
; PV-WAVE prints:
; This is
; some sample
; data.
FREE_LUN, unit
See Also
For information on opening files and choosing LUNs, see the PV‑WAVE Programmer’s Guide.