主题:[讨论]欢迎大神们进来看看~编译时遇到问题~!!!求解决啊!!!!一时手贱,标题就长~~
nigel332
[专家分:40] 发布于 2012-11-18 14:10:00
编译的时候出现:
Fortran runtime error: I/O past end of record on unformatted file
这是什么情况?
求解答!
为什么文件会出现读到结束的提示?
最后更新于:2012-11-18 15:39:00
回复列表 (共4个回复)
沙发
nigel332 [专家分:40] 发布于 2012-11-19 08:43:00
这是写入A中数据的主要代码:
open( lu_xintout, file='A', status='unknown', form='unformatted' )
do nmr=1,nmesh
do nmd=1,nmesh
write(lu_xintout) nuintr(nmr,nmd)
enddo
enddo
do m = 1,nmesh
if( phantom(m) ) cycle
write(lu_xintout) ibpnts(m), iipnts(m), iieptr(m), iisptr(m), &
mjmax(m), mkmax(m), mlmax(m)
enddo
write(lu_xintout) (jt(n),n=1,iipnts(m)),(kt(n),n=1,iipnts(m)), &
(lt(n),n=1,iipnts(m)),(dxt(n),n=1,iipnts(m)), &
(dyt(n),n=1,iipnts(m)),(dzt(n),n=1,iipnts(m))
write(lu_xintout) (jt(n),n=1,ibpnts(m)),(kt(n),n=1,ibpnts(m)), &
(lt(n),n=1,ibpnts(m)),(ibc(n),n=1,ibpnts(m))
write(lu_xintout) iblank
call write_summary( ibpnts, iipnts, fringe1_orphan, &
fringe2_orphan, level1_bp, level1_st, level2_bp, level2_st )
return
板凳
nigel332 [专家分:40] 发布于 2012-11-19 08:45:00
这是从A中读取数据的代码
OPEN( 3,file='A', STATUS='old', FORM='unformatted')
DO m = 1,nmesh
READ(1,*) name(m)
ENDDO
!
! Read dimensions and array pointers from A for all meshes
!
DO m = 1,nmesh
READ(3)ibpnts(m),iipnts(m),iieptr(m),iisptr(m),mjmax(m),mkmax(m),mlmax(m)
READ(3)
READ(3)
READ(3)
ENDDO
REWIND(3)
! Read interpolation and iblank data from A
!
READ(3)
READ(3)
READ(3) (jb(n),n=1,ibpnts(m)), (kb(n),n=1,ibpnts(m)), &
(lb(n),n=1,ibpnts(m)), (ibc(n),n=1,ibpnts(m))
READ(3) iblank
3 楼
nigel332 [专家分:40] 发布于 2012-11-19 15:13:00
我想如果我按照写入文件的方式来读取数据就不会出现读到结尾的问题了吧
于是我把写入数据文件的代码修改为:
do nmr=1,nmesh
do nmd=1,nmesh
write(lu_xintout) nuintr(nmr,nmd)
enddo
enddo
do m = 1,nmesh
write(lu_xintout) ibpnts(m)
write(lu_xintout) iipnts(m)
write(lu_xintout) iieptr(m)
write(lu_xintout) iisptr(m)
write(lu_xintout) mjmax(m)
write(lu_xintout) mkmax(m)
write(lu_xintout) mlmax(m)
write(lu_xintout) (jt(n),n=1,iipnts(m))
write(lu_xintout) (kt(n),n=1,iipnts(m))
write(lu_xintout) (lt(n),n=1,iipnts(m))
write(lu_xintout) (dxt(n),n=1,iipnts(m))
write(lu_xintout) (dyt(n),n=1,iipnts(m))
write(lu_xintout) (dzt(n),n=1,iipnts(m))
write(lu_xintout) (jt(n),n=1,ibpnts(m))
write(lu_xintout) (kt(n),n=1,ibpnts(m))
write(lu_xintout) (lt(n),n=1,ibpnts(m))
write(lu_xintout) (ibc(n),n=1,ibpnts(m))
write(lu_xintout) iblank
而读取数据的代码改为:
do m=1,nmesh
do aaaa=1,nmesh
read(3) aaaaaa(m,aaaa)
enddo
enddo
DO m = 1,nmesh
READ(3) ibpnts(m)
READ(3) iipnts(m)
READ(3) iieptr(m)
READ(3) iisptr(m)
READ(3) mjmax(m)
READ(3) mkmax(m)
READ(3) mlmax(m)
READ(3) (ja(n),n=1,iipnts(m))
READ(3) (ka(n),n=1,iipnts(m))
READ(3) (la(n),n=1,iipnts(m))
READ(3) (dxta(n),n=1,iipnts(m))
READ(3) (dyta(n),n=1,iipnts(m))
READ(3) (dzta(n),n=1,iipnts(m))
READ(3) (jb(n),n=1,ibpnts(m))
READ(3) (kb(n),n=1,ibpnts(m))
READ(3) (lb(n),n=1,ibpnts(m))
READ(3) (ibc(n),n=1,ibpnts(m))
READ(3) iblank
这样输出就和输入对应,应该不会出现读取到文件尾的问题了吧?
结果出现这个问题:
段错误 (核心已转储)
溢出了!!!!!求解答!
4 楼
nigel332 [专家分:40] 发布于 2012-11-19 17:29:00
问题已经解决!谢谢关注!
我来回复