On Fri, 16 Jun 2000, mbai wrote:
> Please kindly advise me how to use Fortran AUTOMATICALLY read all data from
> different files and then write into one files?
>
> data1.txt
> data2.txt
> ...
> data2000.txt
>
> There are three columns of data in every file. I want write all data into 1
> file with name of data.txt.
Try the following (untested):
character :: file*12, line*80
open(10,file='data.txt')
do i=1,2000
write(file,'("data",i0,".txt")') i
open(11,file=file)
do
read(11,iostat=ios) line
if (irs /= 0) exit
write(10) trim(line)
end do
close (11)
end do
end
Hope that works and helps,
Roland
+----------------------------------------------------------------------+
| Roland Schilling Home-Office: +49(89)32929-670 |
| Max-Planck-Institut fuer Quantenoptik Phone: +49(89)32905-265 |
| Hans-Kopfermann-Str. 1 Fax: +49(89)32905-200 |
| D-85748 Garching E-mail: [log in to unmask] |
| Germany http://www.geo600.uni-hannover.de |
+----------------------------------------------------------------------+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|