Thread Closed

Fortran output file

 
Share Thread Thread Tools
Dec14-08, 09:29 AM   #1
 

Fortran output file


Hi guys,

I am tryin to get my program to output multiple files with the name of the file dependent on a number of integer variables in the program, any help with this would be greatfully appreciated.

Cheers
PhysOrg.com
PhysOrg
science news on PhysOrg.com

>> 'Whodunnit' of Irish potato famine solved
>> The mammoth's lament: Study shows how cosmic impact sparked devastating climate change
>> Curiosity Mars rover drills second rock target
Dec14-08, 01:16 PM   #2
 
You can try something along these lines (for F77).
Take care about the leading zeroes if you have different number of digits in the numeric part of the file.

Code:
      character*12 filename
      character*1 num
      do 20 I=1,9
      write(num,999)I
 999  format(I1)
      filename='A'//num//'.dat'
      print *,filename
      open(unit=5,file=filename, status='unknown')
   20 continue
Output:
Code:
A1.dat
A2.dat
A3.dat
A4.dat
A5.dat
A6.dat
A7.dat
A8.dat
A9.dat
Thread Closed
Thread Tools


Similar Threads for: Fortran output file
Thread Forum Replies
Problems reading binary file in FORTRAN Programming & Comp Sci 1
Accessing Fortran Modules within a Fortran library from Fortran Programming & Comp Sci 0
Convert a text file into an image (or generate an image with fortran) Computing & Technology 1
Make a Pdf file into an ordinary web file (html file)? Computing & Technology 3
LaTeX output not copied to FILE ! Why? Math & Science Software 17