[Fortran] 纯文本查看 复制代码 program pot_head
USE IFPORT
implicit none
integer i, j, n, ierr
character(len=512) :: str = ''
open(11,file='aa.cube',status='old')
open(12,file='temp1')
do i = 1, 10
read(11,"(a)",iostat=ierr) str
if(str(9:10)=='E' .or. ierr/=0) exit
write(12,"(a)") trim(str)
end do
close(11)
open(13,file='pot.cub',status='old')
do
read(13,"(a)",iostat=ierr) str
if (ierr/=0) exit
write(12,"(a)") trim(str)
end do
close(13,status='delete')
close(12)
! ivf扩展函数,改文件名
i = rename('temp1','pot.cub')
if(i==0) then
write(*,*) '成功'
else
write(*,*) '失败'
end if
read(*,*)
end program pot_head
|