本文采用Fortran语言,实现文件中关键字的识别
----------------------------------------------
程序源代码
program check_Itemimplicit none integer::i,j,k,str_len,str_len_in,check_num integer::countnum logical::alive character*400 temp,in_temp,stopexe character*400 file_path,file_name integer,External::GetFileNum,GetFileNum_blank file_path="C:\001-document\007_MyCodeForWeChat\2CheckItem" file_name="\Data.csv" stopexe="999" stopexe=trim(stopexe)write(*,*)write(*,*) "***\\\ Comparing Item"write(*,*) "***\\\ From ZhaoZe"write(*,*)write(*,*) "***--- Data is From"write(*,*) "***--- ",trim(file_path)write(*,*) "***--- ",trim(file_name)write(*,*)write(*,*) do k=1,100 !open(7,file=file_name) open(7,file=trim(file_path)//trim(file_name)) inquire(file=trim(file_path)//trim(file_name),exist=alive) if (alive) then write(*,*) "input the check name--(""999"" stop the running exe)" read(*,*) in_temp if (trim(in_temp)/=stopexe) then str_len_in=LEN(trim(in_temp)) call Character_change(in_temp) countnum=GetFileNum_blank(7) write(*,*) countnum check_num=0