Last active
December 20, 2015 23:29
-
-
Save shane5ul/6212831 to your computer and use it in GitHub Desktop.
write to a file with a variable filename
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
program foo | |
character(len=12) :: filename | |
integer :: i | |
i = 10 | |
write (filename, "(A4,i0.4,A4)") "file", i,".dat" | |
print*, trim(filename) | |
open(1, file=filename) | |
! write to the file | |
close(1) | |
end program foo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment