FORTRAN中读入文件时出错,显示为“unformatted I/O not consistent with open opinions”,什么意思?
2个回答
展开全部
program Main
implicit none
integer, parameter :: iN = 40
integer :: iRec, i
real :: rTemp(iN)
open (10, file = "D:\321\11.txt")
do i = 1, iN
read (10, *) rTemp(i)
print*, rTemp(i)
end do
close (10)
open (20, file = "111.txt", form = "unformatted", access = "direct", recl = 10)
iRec = 0
do i = 1, iN
iRec = iRec + 1
write(20, rec = iRec) rTemp(i)
write(*, *) rTemp(i)
print*, i
end do
close (20)
open (22, file = "111.txt", form = "binary", access = "direct", recl = 10)
do i = 1, 2
read (22, *) rTemp(i)
print*, rTemp(i)
end do
close (22)
end Program Main
implicit none
integer, parameter :: iN = 40
integer :: iRec, i
real :: rTemp(iN)
open (10, file = "D:\321\11.txt")
do i = 1, iN
read (10, *) rTemp(i)
print*, rTemp(i)
end do
close (10)
open (20, file = "111.txt", form = "unformatted", access = "direct", recl = 10)
iRec = 0
do i = 1, iN
iRec = iRec + 1
write(20, rec = iRec) rTemp(i)
write(*, *) rTemp(i)
print*, i
end do
close (20)
open (22, file = "111.txt", form = "binary", access = "direct", recl = 10)
do i = 1, 2
read (22, *) rTemp(i)
print*, rTemp(i)
end do
close (22)
end Program Main
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询