本帖最后由 lumlngz 于 2023-4-24 17:34 编辑
我想用文本数据的某一行作为新文件夹的名字,但是运行时出现错误,请各位大佬不惜吝教,感谢感谢。program main
[Fortran] 纯文本查看 复制代码 program main
implicit none
integer::num,i,s=30
character(10)::dirname
character(10)::filename
character(10)::name
real::a ,b ,c ,d
open(10,file='111.txt',form='formatted',access='direct',recl=26)
do i=1,20
read(10,*,rec=i,iostat=num)a ,b ,c ,d ,name
if (num /= 0) exit
write(dirname,'(A10)')name
write(filename,'(A10,".txt")')name
call system("mkdir "//dirname)
open(s,file=trim(dirname)//'/'//filename,form='formatted',access='direct',recl=26)
write(s,*,rec=i)name
close(s)
s=s+1
enddo
endprogram |