cooln
Mechanical
- Jul 20, 2007
- 4
So I am writing a fotran90 code in which I run an executable using system calls:
call system('./myexec')
The executable program writes the data into output file opdata.dat which fortran reads:
read(unit=1,file='opdata.dat',status='old')
!
! Read output data from file
!
close(1)
However, the trouble is the executble takes a long time to complete the process. In the meantime, the read statement tries to access the non-existent file opdata.dat, and obviously return with error. So how do I pasue execution of my fortran code till the process is complete?
One way I can do this is to inquire whether file opdata.dat exists:
inquire(file='opdata.dat',exist=lexist)
and proceed further only when the file exists.
Is there any other elegant way to achive this ?
Thanks!
call system('./myexec')
The executable program writes the data into output file opdata.dat which fortran reads:
read(unit=1,file='opdata.dat',status='old')
!
! Read output data from file
!
close(1)
However, the trouble is the executble takes a long time to complete the process. In the meantime, the read statement tries to access the non-existent file opdata.dat, and obviously return with error. So how do I pasue execution of my fortran code till the process is complete?
One way I can do this is to inquire whether file opdata.dat exists:
inquire(file='opdata.dat',exist=lexist)
and proceed further only when the file exists.
Is there any other elegant way to achive this ?
Thanks!