1) You are opening different files with the same handle
2) Formatting the filename
Problem 1
Use an array for the file handles
Code:
integer handle(100)
do i = 1, n
open (handle(i), ...)
enddo
Problem 2
Formatting - the problem is getting the integer in string form without a leading space
Code:
character*10 strnum
character*20 filename
integer handle(100)
do i = 1, n
write (strnum, *) i, '.txt'
name = 'data' // strnum(2:)
print *, 'Opening ',name
open (handle(i), file=name)
enddo
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.