Code Comments
Programming Forum and web based access to our favorite programming groups.Hello, I would like to know if there is a way to open a list of files and read them. examples like file a b c d ,... and read values of x,y in them
Post Follow-up to this messagewiggy13 wrote: > Hello, > I would like to know if there is a way to open a list of files > and read them. examples like file a b c d ,... and read values of x,y > in them You can store the list of file names in a file and then have your program read the file names and then open them. In my programs, the input files are usually in the same directory and share the same suffix, so the full file names can be constructed from the directory name, prefix, and suffix using the // operator and the TRIM function. Do all the files need to be open at the same time? I think compilers limit the number of files that can be open at one time.
Post Follow-up to this messageHi, How do you do that? Let say I got files like acx-800.txt, acx-801.txt, ... all this are consists of x and y data in them. Usually I read each by acx-800.txt usually i compile by f77 prog.f then it a.out when I try a.out I enter infile and return How do u try to "a.out infile" in one line and return I'm still new at this **************************************** ************************************ ***** read (*, '(a80)') infile lun = 10 open (unit=lun, file = infile, 1 form = 'formatted', status = 'old') i = 0 ios = 0 do while ( ios .eq. 0 ) read (lun, fmt = '(a80)', iostat = ios) line if (ios .eq. 0 .and. line(1:1) .ne. '"') then i = i + 1 read (line, *) x(i),y(i) endif end do close (lun)
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.