返回首页
内部文件
见下面例子:
program innerfile
character(10) str1,str2
integer no_str
real value
str1="110"
value=123.45
read(str1,100) no_str
write(str2,200) value
write(*,300) no_str,str2
write(*,400) str2,value
100 format(I3)
200 format(f10.3)
300 format(1x,i3,1x,a10)
400 format(1x,a10,1x,f10.3)
end program
外部文件
外部文件的一些操作函数如下:
open([unit=]设备号,file=文件名[,err=语句标号][,status=属性]) !打开文件
close([unit=]设备号[,err=语句标号][,iostat=ix][,status=属性]) !关闭文件
read(设备号,格式说明[,end=语句标号]) 输入变量表 !读取文件
write(设备号,格式说明) 输出变量表 !写入文件
rewind(设备号) !指针回到文件开头