回 帖 发 新 帖 刷新版面

主题:请教Fortran写文件的问题

请不吝赐教!

用fortran写txt文件,无论是formatted还是unformatted似乎都是二进制文件,全是乱码。
请问怎么能写入人可读的文本文件呢?

回复列表 (共2个回复)

沙发


可以了。。。

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的帮助文档写得太不清楚了。。。

板凳


使用文件直接访问方式写文件,可以写成文本文件么?

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

这样写入的文件就是乱码。

我来回复

您尚未登录,请登录后再回复。点此登录或注册