robelee
04-04-2004, 03:51 PM
Hi
I kindly wonder if anyone could see what's wrong with this program. It only writes rubbish to the screen. The object is to read a file and search for a word in a file and then outputs all the lines in file that does not contain the word.
Any help appreciated...
program uppgift3
character :: file, word
file='wordfile'
word='exam'
call remove(file, word)
end program uppgift3
subroutine remove(file word)
character :: file, word
character (80) :: line
integer :: i, j
open(10, file='file')
read(10, '(a)', iostat=i)line
if (index(rad, word)==0) print*, line
if (i<0) return
end subroutine remove
I kindly wonder if anyone could see what's wrong with this program. It only writes rubbish to the screen. The object is to read a file and search for a word in a file and then outputs all the lines in file that does not contain the word.
Any help appreciated...
program uppgift3
character :: file, word
file='wordfile'
word='exam'
call remove(file, word)
end program uppgift3
subroutine remove(file word)
character :: file, word
character (80) :: line
integer :: i, j
open(10, file='file')
read(10, '(a)', iostat=i)line
if (index(rad, word)==0) print*, line
if (i<0) return
end subroutine remove