CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   read a list of files using fortran 77 (https://www.cfd-online.com/Forums/main/110361-read-list-files-using-fortran-77-a.html)

sp_song December 9, 2012 20:47

read a list of files using fortran 77
 
Hello,

I have a question on how to read a list of data files using fortran 77:

For example, I have 200 files:

data.0100.inp
data.0101.inp
data.0102.inp
.....
data.0299.inp

I don't know how to handle the characters 01** in fortran 77. Could you please comment on this?

Thanks a lot!

Steve

Rami December 10, 2012 09:09

Quote:

Originally Posted by sp_song (Post 396564)
Hello,

I have a question on how to read a list of data files using fortran 77:

For example, I have 200 files:

data.0100.inp
data.0101.inp
data.0102.inp
.....
data.0299.inp

I don't know how to handle the characters 01** in fortran 77. Could you please comment on this?

Thanks a lot!

Steve

Hello steeve,

Try the following:

...
character*13 fn
...
do i = 100, 299
write(fn, 'a6, i3, a4', 'data.0', i, '.inp')
open(lunit, fn, ...)
...
enddo
...


All times are GMT -4. The time now is 02:29.