delete.f90
来自「fortran程序」· F90 代码 · 共 43 行
F90
43 行
program delete_half
USE DFLIB
implicit none
character(len=79) :: filename,text
character(len=79) :: buffer
character(len=79) :: probn
integer, parameter :: fileid = 10
integer :: status = 0
logical alive
integer len1
open(unit=20,file="inp")
read(unit=20, fmt="(A79)") text
write(*,*) text
read(unit=20, fmt="(A79)") probn
len1=len_trim(probn)
!inquire( file=probn(1:len1)//'.dat', exist=alive)
open(unit=10, file=probn(1:len1)//'.txt')
open(unit=11,file=probn(1:len1)//'.out1')
open(unit=12,file=probn(1:len1)//'.out2')
read(unit=10, fmt="(A79)", iostat=status ) buffer
do while(.true.)
read(unit=10, fmt="(A79)", iostat=status ) buffer
write(11,"(A79)") buffer
if ( buffer==' end' ) exit
read(unit=10, fmt="(A79)", iostat=status ) buffer
write(12,"(A79)") buffer
if ( buffer==' end' ) exit ! end就跳出循环
end do
write(11,*) "end"
write(*,*) " OK!"
close (10)
close (11)
close (12)
stop
end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?