主题:从dat到txt的读取,能输出到屏幕上,但是输出到文件就错了,求大侠指点
我要把jan.tmp.dat文件用fotran转成txt文件,能输出到屏幕上,但是要输出到txt文件老出错。请高手指点,感谢!
dat文件的ctl说明文件
dset d:/lw/dat/tmp/jan-dec/jan.tmp.dat
title CRU TS 3.10 Mean Temperature
undef 9.96921e+36
xdef 720 linear -179.75 0.5
ydef 360 linear -89.75 0.5
zdef 1 linear 0 1
tdef 109 linear 00Z16Jan1901 12mon
vars 1
tmp 0 99 tmp mon
endvars
从dat转txt的fotran程序
program tmptxt
implicit none
real,dimension(720,360,109):: tmp
integer:: irec1,i,j,t
open(1,file='d:/lw/dat/jan.tmp.dat',form='binary',access='direct',recl=720*360)
open(2,file='d:/lw/dat/jan.tmp.txt',form='formatted',status='unknown')
irec1=0
do t=1,109
irec1=irec1+1
read (1,rec=irec1) ((tmp(i,j,t),i=1,720),j=1,360)
write(2,rec=irec1) ((tmp(i,j,t),i=1,720),j=1,360)
end do
close(1)
close(2)
end
编译出错:
forrtl: severe (66): output statement overflows record, unit 2, file d:\lw\dat\jan.tmp.txt
Image PC Routine Line Source
tmp.exe 00408A69 Unknown Unknown Unknown
Incrementally linked image--PC correlation disabled.
Press any key to continue