Get the next non-blank character in the current record.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
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. |
subroutine get_next_non_blank_character_this_record(unit, ch, iostat, iomsg) !< Get the next non-blank character in the current record. 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. do ! we spcify non-advancing, just in case we want this callable outside the context of a child input statement ! the PAD specifier simply saves the need for the READ statement to define ch if EOR is hit ! read(unit, "(A)", iostat=iostat, iomsg=iomsg, advance='NO') ch ! ...but that causes ifort to blow up at runtime read(unit, "(A)", iostat=iostat, iomsg=iomsg, pad='NO') ch if (iostat /= 0) return if (ch /= '') exit enddo endsubroutine get_next_non_blank_character_this_record