fortran标准没有判断文件夹的功能,你可以直接open该文件夹中一个文件 open(10,file='2003336\data.txt',iostat=i,iomsg=msg) ,配合iostat 和 iomsg就知道是否存在文件夹。[Fortran] 纯文本查看 复制代码 program test
integer i, k
character(80) msg
open(10,file='2003336\data.txt',iostat=i,iomsg=msg)
if(i/=0) then
call execute_command_line('md 2003336')
open(10,file='2003336\data.txt',iostat=i,iomsg=msg)
end if
if(i/=0) then
write(*,"(a)") trim(msg)
end if
pause
end |