想TXT读40位的整数,读不出来。试了很多遍,发现代码30行取I15时能读出来,读15位后就报错了,怎么解决?[Fortran] 纯文本查看 复制代码 program test
implicit none
integer :: Npop,tmin
INTEGER(KIND=2) ::Run_time
integer( kind = 8 ) :: Gene
CALL Get_Best (8,10,1,Gene)
write(*,*)'Gene:',Gene
end program test
! ******************** Get_Best *****************
subroutine Get_Best (tmin,Npop,Run_time,Gene)
implicit none
integer,intent(in) :: tmin,Npop
integer :: Run_time
integer(KIND=8) :: Gene
integer(KIND=8),dimension(Npop) :: GeneZ
integer :: i,l
CHARACTER(LEN = 2) :: cRun_time
character(LEN=100) :: Nome,annotation
CHARACTER(*), PARAMETER :: fileplace = "D:/simulation/"
write(cRun_time,'(I2)') Run_time
Nome = TRIM(ADJUSTL(cRun_time))//'namlist_in.txt'
OPEN(1,file = fileplace//Nome,status='old',FORM='FORMATTED')
read(1,'(A)') annotation
read(1,'(6X,I40)') (GeneZ(i),i=1,Npop)
close(1)
write(*,*)'GeneZ:',GeneZ
Gene=GeneZ(tmin)
end subroutine Get_Best
|