I have a program in Fortran that saves the results to a file. At the moment I open the file using
OPEN (1, FILE = \'Output.TXT\')
However,
Try the following:
.... character(len=30) :: filename ! length depends on expected names integer :: inuit .... do i=1,n write(filename,'("output",i0,".txt")') i open(newunit=iunit,file=filename,...) .... close(iunit) enddo ....
Where "..." means other appropriate code for your purpose.