Subject: read error
From: "mbai" <[log in to unmask]>
To: <[log in to unmask]>
Dear Sir,
I want to put all the data in thousands of data files (data1.txt,
data2.txt,...) into ONE file (data.txt).
To simply the question, there is one column data in every files. Using
(Microsoft) Fortran
PowerStation 4.0, however, the program does not work.
Please try according to following three data files, for example, by saving
three data files into working directionary.
Looking forward to your advise.
Thank you a lot.
Mingwu Bai, Ph. D
Tohoku University
Japan
----------------------
character :: file*12
open(10,file='data.txt')
do i=1,3
write(file,'("data",i0,".txt")') i
open(11,file=file)
do
read(11,iostat=ios) aa
if (ios /= 0) exit
write(10,*) aa
end do
close (11)
end do
end
Firstly, the code uses the I0 format descriptor, which was
introduced in Fortran 95, and hence the code needs to be
compiled with an F95 compiler.
Secondly the variable aa, for which no type is declared and
hence will be of type REAL, is read in binary but written
out using format = `*'.
Alan.Miller @ vic.cmis.CSIRO.AU = Alan Miller, Honorary Research Fellow (Retired)
CSIRO Mathematical & Information Sciences, Melbourne, Australia
Phone: +61 3 9545-8036 Fax: +61 3 9545-8080 URL: http://www.ozemail.com.au/~milleraj
Mail: CSIRO CMIS, Private Bag 10, Clayton South MDC, Vic. 3169, Australia
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|