- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm trying to convert to Intel 7.0 from CVF and noticed that Intel doesn't seem to have a function similar to CVF's EOF function. The code is looping through a number of files and checks for empty files using the following lines:
REWIND (UNIT = UNITNO (INDEX))
ENDFIL = EOF (UNITNO (INDEX))
Does Intel 7.0 have a similar function that I just haven't found, or am I going to have to try and read from each file to determine if it is empty?
Thanks
Tim Coletta
REWIND (UNIT = UNITNO (INDEX))
ENDFIL = EOF (UNITNO (INDEX))
Does Intel 7.0 have a similar function that I just haven't found, or am I going to have to try and read from each file to determine if it is empty?
Thanks
Tim Coletta
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Intel Fortran doesn't have EOF yet. You'll have to do the test READ yourself. (This would also be more portable.)
Steve
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
So try to spot all EOF() clauses in the CVF environments and convert to test iostat.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
An alternative might be to emulate this function using something like:
logical function eof(unit) integer :: unit character(len=1) :: onechar integer :: ierr read( lun, iostat = ierr, '(a)' ) onechar eof = ierr /= 0 end function
If there are unformatted files, you will need to extend this. And you may want to distinguish between an error and a "true" end-of-file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Change Line-8 of the code in #4 to eof = ierr /= -1 to exclude EOR and other conditions, and note that the specific value dedicated to signify EOF is compiler-dependent, but you can USE ISO_FORTRAN_ENV and use the named constant IOSTAT_END instead.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page