作者Gwaewluin (神无月 孝臣)
看板Fortran
标题[问题] binary档写档错误
时间Fri Mar 6 16:54:38 2009
原本程式的架构是计算出来data後,写入binary档里面
然後再将binary档里的资料读进矩阵里去进行後面的运算
这部分在使用上是没发生过问题的,就算是比较大的data档也可以顺利跑
现在由於要进行程式的测试
所以想先跳过前面计算data的动作,直接将现有的data写进binary档里
然後再将binary里面的资料读进矩阵里做後续运算
可是做了修改後,发现只要是大一点的data要写入binary时就会跟我说错误
debug模式下compile出来的执行档会跑出这个错误讯息
forrtl: severe (37): inconsistent record length, unit 17, file E:\My
Projects\unwarp6\unwarp6\fort.17
错误的那行为:write(17,rec=ii+1)countera
release模式底下compile出来的执行档会跑出这个错误讯息
forrtl: severe (37): inconsistent record length, unit 16, file E:\My
Projects\unwarp6\unwarp6\fort.16
16和17都是我在写data时所开的binary档
open(16,file='m.txt',form='binary',access='direct',recl=4,
1 status='replace')
open(17,file='i.txt',form='binary',access='direct',recl=4,
1 status='replace')
这两个我检查了很久一直都找不出来record lenght到底错在哪里
因为使用原本那种将计算出来的data写入还没看到这种错误过
data的格式我也不知道错在哪里
写入16和写入17的data宣告的格式都是integer,也不知道为何写不进去
原本我是用intel fortran 11,後来我换了康柏的fortran来做compile
debug和release模式都一样也是会跑出record length的错误出来
到最後一样找不出问题点在哪里
为什麽原本写法可以把大上非常多的data写入binary都没问题
修改写法却出现没多大的data要写入就会说record length错误
而且我的测试是根本没有写入几笔就会出现错误了
请问有人有看过类似的问题吗?
--
Deserves death! I daresay he does. Many that live deserve death. And some die
that deserve life. Can you give that to them? Then be not too eager to deal out
death in the name of justice, fearing for your own safty. Even the wise cannot
see all ends.
Gandalf to Frodo
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.120.25.235
1F:推 janhon:是不是超过2G ? 03/06 18:31
2F:→ Gwaewluin:我测试只有写入30几笔资料就跟我说错误 03/06 19:04
3F:→ blc:写入的data都是real*4吗? 03/06 22:32
4F:→ blc:抱歉眼残… 03/06 22:34