Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

variable extensions: file.dat_//string

Status
Not open for further replies.

galileo1972

Technical User
Feb 17, 2003
14
DE
hi,

i have a big problem :)

in my monte carlo simulations i do have a time warp, how can i convert the integer timer (from another subroutine)to a string timer (character timer) to get the following file output with variable extensions:

integer timer
common timer


open(1,file='hello.dat_'//timer)
do t=1,10
.........
write(1,*) .......
endo


i need e.g. 10 outputs with the same filename hello.dat but with variable extensions according to the timer

hello.dat_timer

please help me

marc
 
simply create your datafile name from a write statement:

Code:
character*12 fnName
write(fnName,'(A,I2.2)') 'hello.dat_',timer
open(1, file=fnName)
do t=1,10
   ....
   write(1,*) ...
end do

your filenames should look like: hello.dat_01, hello.dat_02,....

you can also use different format if you want do distinguish timers less than 10 (the format should look like '(A,I1)' for timers < 10 and '(A,I2)' for timers > 10 but < 100)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top