Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
New Contributor I
3 Views

Fortran I/O functions

A trip around Fortran I/O functions.
A Fortran application, launched by a C++ driver, writes a stream file which is later processed by the C++ application.
Now to add a backup feature, the fortran application at a certain point should:
1) find the actual position of the file (INQUIRE   POS=ipos1) 
2)  write additional data, close and copy the file.
3) reopen the file and reposition at ipos1, for continuing the execution.

I am unable to find a fortran statement/specifier to restart writing data at ipos1.

  

 

0 Kudos
2 Replies
Highlighted
New Contributor I
3 Views

You can use

You can use

write(unit, pos = ipos) stuff

with stream I/O. See Metcalf, Reid & Cohen Modern Fortran Explained 10.16.

0 Kudos
Highlighted
3 Views

open output fileopen copy

open output file
open copy file//sequence number
loop:
  ...
  write to output file
  write to copy file
  if(time to close copy file) then
    write additional stuff to copy file
    close copy file
    bump sequence number
    open copy file//sequence number
  end if
end loop

Jim Dempsey

0 Kudos