0
Program main 
use ifport 

implicit none
integer ii,fileid 
double precision pi
logical result
character*256 path,filename,fileNum
pi = 4.d0*datan(1.d0)
ii = 20
path = './testforlder'

result = makedirqq(path)

Do ii = 1, 11

fileid = 1 + ii
write(fileNum,"(A10,I1,A4)") "/TimeStep-",ii,".txt" 
filename = trim(path)//trim(fileNum)
open(unit = fileid,file=filename,status='unknown')
write(fileid,*) "The result is:", ii,pi,2*pi
close(fileid)

End Do  

pause
End Program   

My code is written as above. When the loop step is less than 10, it works. However, when the loop step >= 10 (for example: 11), it fails.

FortranFun
  • 156
  • 1
  • 11

0 Answers0