fortran inquire语句

!下面这一段用于确认指定名字的文件是否存在
inquire(file=filenamein, exist=alive)  !如果存在,alive赋值为0
if(.NOT. alive) then
write(*,*) trim(filenamein), " doesn't exist." !文件不存在 trim用于删去filenamein中字串

可以使用 INQUIRE 语句
50 INQUIRE(FILE=要查找的文件名,EXIST=ALIVE)
IF(ALIVE.EQ.0) THEN ! 存在文件
要执行的语句
goto 50
else
goto 50
END IF
原文地址:https://www.cnblogs.com/guosj/p/5162167.html