Re: dynamic filename string
- From: gary.l.scott@xxxxxxxx
- Date: Tue, 27 Nov 2007 13:51:11 -0800 (PST)
On Nov 27, 3:34 pm, apek <apek1...@xxxxxxxxx> wrote:
Í need to store data in seperate files dependeng on some integerprogram fn
count, e.g.,
Do i = 1, N
...
filename = ?
...
Open(unit=1, file=filename,action="write",status="replace")
...
Close(1)
End do
How can I update the filename, such that it become a dynamic string
depent on the index i as follows
i=1 -> filename="data1.txt"
i=2 -> filename="data2.txt"
...
Allan
character(80) :: filename = ' '
integer :: i = 0
do i = 1,10
write(filename,'(a,i0,a)')'data',i,'.txt'
write(*,*)'fn=',trim(filename)
end do
end
If your compiler doesn't support "i0" format, you could write the
integer separately to a character variable and use adjust, trim, and
concatenation operators.
.
- Follow-Ups:
- Re: dynamic filename string
- From: fj
- Re: dynamic filename string
- From: Jan Vorbrüggen
- Re: dynamic filename string
- References:
- dynamic filename string
- From: apek
- dynamic filename string
- Prev by Date: dynamic filename string
- Next by Date: Re: Parallelization on Dell Workstations
- Previous by thread: dynamic filename string
- Next by thread: Re: dynamic filename string
- Index(es):
Relevant Pages
|
|