Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | unit | |||
character(kind=CK,len=1), | intent(out) | :: | ch | |||
integer, | intent(out) | :: | iostat | |||
character(kind=CK,len=*), | intent(inout) | :: | iomsg |
subroutine get_next_non_blank_character_any_record(unit, ch, iostat, iomsg)
!< Get the next non-blank character, advancing records if necessary.
integer, intent(in) :: unit !< Logical unit.
character(kind=CK, len=1), intent(out) :: ch !< The non-blank character read. Not valid if IOSTAT is non-zero.
integer, intent(out) :: iostat !< IO status code.
character(kind=CK, len=*), intent(inout) :: iomsg !< IO status message.
character(len(iomsg)) :: local_iomsg !< Local variant of iomsg, so it doesn't get inappropriately redefined.
do
call get_next_non_blank_character_this_record(unit=unit, ch=ch, iostat=iostat, iomsg=local_iomsg)
if (is_iostat_eor(iostat)) then
! try again on the next record
read (unit, "(/)", iostat=iostat, iomsg=iomsg)
if (iostat /= 0) return
elseif (iostat /= 0) then
! some sort of problem
iomsg = local_iomsg
return
else
! got it
exit
endif
enddo
endsubroutine get_next_non_blank_character_any_record