>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
Nope. It won't work:
> if (irs /= 0) exit
should be:
> if (ios /= 0) exit
--
------------------------------------------------
drs. Marcel Swart
Theoretical Chemistry (MSC)
Molecular Dynamics (GBB)
Rijksuniversiteit Groningen
Chemistry Department
Nijenborgh 4
9747 AG Groningen
The Netherlands
tel : +31 - (0)50 - 3634377
fax : +31 - (0)50 - 3634441
E-mail : [log in to unmask]
WWW: http://theochem.chem.rug.nl/~marcel/
------------------------------------------------
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|