Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
program read_filename
! Declare array of filenames with max length allowed by operating system
! that way the filenames may include the complete path ID
character*256 filename(10)
integer istat,j,nfiles
nfiles=0
! open file where you read the filenames from
open(unit=20,file='inputfile.txt',status='old',iostat=istat)
rewind 20
! read filenames from file
if (istat.eq.0) then
j=1
do
read(20,'(a256)',iostat=istat)filename(j)
if(istat.ne.0)exit
j=j+1
enddo
! clear up
close (unit = 20)
nfiles = j
endif
! to open one of the files you might want to remove the trailing blanks
!(my compiler does not like trailing blanks in filenames)
! for instance using the intrinsic 'trim'
! If there may be leading blamks in your filenames use ADJUSTL first to lefttrim.
if(nfiles.gt.0)then
open(unit=30,file=trim(filename(3)),........)
! enter your statements
endif
call opendir (path, handle, errno)
do while (errno .eq. 0)
call readdir (handle, name, namelen, errno)
if (errno .ne. 0) exit
... do something with name, probably stat or fstat
end do
call closedir (handle, errno)