Get number of lines till some character like "#"
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=1), | intent(in) | :: | till | |||
integer, | intent(in) | :: | infile |
function get_number_of_line(till, infile) result(number)
!< Get number of lines till some character like "#"
implicit none
integer ,intent(in) :: infile
character(len= 1),intent(in) :: till
character(len=64) :: buf
integer :: ios
integer :: number
number=0
do while(.true.)
read(infile, *, iostat=ios) buf
if(trim(buf)==till) EXIT
if(is_iostat_end(ios)) EXIT
number = number + 1
end do
end function get_number_of_line