0

I'm trying to mass create files dependent on where I am in a do loop, and I've tried converting an integer to a character and I'm going around in circles.

My code is along the following lines,

 do j=1,100,1
  if(mod(j,10)==0) then 
  datafile = "data_"//char(j)//".data"
  open(unit=1,file=datafile)
  end if 
 do i =1,1000,1
  ! some code here...
  write(1,*) info
  end do
  close(1)
 end do   

I've tried using char() but it doesn't work, I've seen some people mention using write() but I can't get that to work either. Does anyone know how to convert an integer to a str in Fortan?

AlphaBetaGamma96
  • 567
  • 3
  • 6
  • 21

0 Answers0