program test
integer i
real s,a
character(512)::filename
call system('dir *.txt /b>1.dat')
s=0.0
open(10,file='1.dat')
do
read(10,'(a)',iostat=i) filename
if(i/=0) exit
open(11,file=filename)
read(11,*) a
close(11)
s = s + a
end do
close(10,status='delete')
end program
li913 发表于 2020-2-16 14:37
群共享,fortran批量处理文件。
欢迎光临 Fortran Coder (http://bbs.fcode.cn/) | Powered by Discuz! X3.2 |