主题:请教Fortran写文件的问题
yycfresh
[专家分:0] 发布于 2010-05-12 11:47:00
请不吝赐教!
用fortran写txt文件,无论是formatted还是unformatted似乎都是二进制文件,全是乱码。
请问怎么能写入人可读的文本文件呢?
回复列表 (共2个回复)
沙发
yycfresh [专家分:0] 发布于 2010-05-12 12:53:00
可以了。。。
open(UNIT=1, FILE = '*.txt', STATUS = 'replace', FORM='formatted')
if (lengthOfDouble >= 6) then
do I = 1, 6
WRITE (1, *) test(I)
end do
end if
fortran的帮助文档写得太不清楚了。。。
板凳
yycfresh [专家分:0] 发布于 2010-05-12 12:59:00
使用文件直接访问方式写文件,可以写成文本文件么?
open(UNIT=1, FILE = '*.txt', STATUS = 'replace', FORM='formatted')
if (lengthOfDouble >= 6) then
do I = 1, 6
WRITE (1, REC=I) test(I)
end do
end if
这样写入的文件就是乱码。
我来回复