|
供参考
设要生成4000个文件,文件名为AA1-AA4000,如何写循环生成文件,而不用写4000次write命令呢?
用内部文件:
character(len=80) :: filename,form
integer :: i
do i=1,4000
select case (i)
case (1:9)
write(form,'(i1)') i
case (10:99)
write(form,'(i2)') i
case (100:999)
write(form,'(i3)') i
case (1000:9999)
write(form,'(i4)') i
end select
write(filename,*) "AA",trim(form),".TXT"
open(10,file=filename)
write(10,*) i
close(10)
end do
stop
end
对于没有规律的文件,好像有软件可以修改文件名。最好该成有规律的,这样比较方便。
http://www.programfan.com/club/showbbs.asp?id=102851 |
评分
-
1
查看全部评分
-
|