fortran 批量复制每个文件只写最后一行
programshengchengimplicitnonecharacter(len=80)::filename,formcharacter(len=120),dimen...
program shengcheng
implicit none
character(len=80) :: filename,form
character(len=120),dimension(352)::B
integer :: i,j
open(20,file="D:\CN000001.gsx")
do j=1,352
read(20,"(A120)") B(j)
do i=1,486
select case (i)
case (1:9)
write(form,'(i1)') i
write(filename,*) "D:\spatial\a\CN00",trim(form),".gsx"
open(10,file=filename)
write(10,"(A120)") B(j)
case (10:99)
write(form,'(i2)') i
write(filename,*) "D:\spatial\a\CN0",trim(form),".gsx"
open(10,file=filename)
write(10,"(A120)") B(j)
case (100:486)
write(form,'(i3)') i
write(filename,*) "D:\spatial\a\CN",trim(form),".gsx"
open(10,file=filename)
write(10,"(A120)") B(j)
end select
close(10)
end do
end do
end 展开
implicit none
character(len=80) :: filename,form
character(len=120),dimension(352)::B
integer :: i,j
open(20,file="D:\CN000001.gsx")
do j=1,352
read(20,"(A120)") B(j)
do i=1,486
select case (i)
case (1:9)
write(form,'(i1)') i
write(filename,*) "D:\spatial\a\CN00",trim(form),".gsx"
open(10,file=filename)
write(10,"(A120)") B(j)
case (10:99)
write(form,'(i2)') i
write(filename,*) "D:\spatial\a\CN0",trim(form),".gsx"
open(10,file=filename)
write(10,"(A120)") B(j)
case (100:486)
write(form,'(i3)') i
write(filename,*) "D:\spatial\a\CN",trim(form),".gsx"
open(10,file=filename)
write(10,"(A120)") B(j)
end select
close(10)
end do
end do
end 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询