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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening new file

Status
Not open for further replies.

fanta2

Technical User
Apr 10, 2005
78
CA
I want to open new files named from 1 to 100 e.g. 1.txt, 2.txt, ... I tried the following but no success...can any one help me plz..

do i=1, 100
open (i, File = '//i//.txt')
code...
close(i)
end do
 
Code:
character*7 str
do i=1, 100
   write (str, 100) i
100 format (I3,'.txt')
   open (i, File = ltrim (str))
   code...
   close(i)
end do
 
XWB ... I would like to thank you so much for the immediate, precise and perfect answer. It simply solved my problem... thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top