program read_1line
implicit none
character(130)::str1
character(52)::str2
real,dimension(63):: cross
integer::rows
open(unit=12,file='cinder.dat',status='old')
do rows=1,162309
read(12,'(a130)') str1,str2
if(str1(1:8)==' #3215') then
write(*,*) str1
read(12,*)cross
write(*,*)cross
read(12,'(a130)') str2
do while(str2(1:1).ne.'#')
backspace(unit=12)
end do
write(*,*) str2
read(12,'(a130)') str1
end if
end do
close(12)
pause
end program read_1line
青衣巷 发表于 2022-9-20 08:59
你要读取的文件是什么样子的?你想要哪一部分?给个范例。
li913 发表于 2022-9-20 09:44
character(512) str, line
do i=1,n
read(12,"(a)") str
欢迎光临 Fortran Coder (http://bbs.fcode.cn/) | Powered by Discuz! X3.2 |