get_next_non_blank_character_this_record Subroutine

private subroutine get_next_non_blank_character_this_record(unit, ch, iostat, iomsg)

Get the next non-blank character in the current record.

Arguments

Type IntentOptional 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.


Called by

proc~~get_next_non_blank_character_this_record~~CalledByGraph proc~get_next_non_blank_character_this_record stringifor_string_t::get_next_non_blank_character_this_record proc~get_next_non_blank_character_any_record stringifor_string_t::get_next_non_blank_character_any_record proc~get_next_non_blank_character_any_record->proc~get_next_non_blank_character_this_record proc~read_formatted stringifor_string_t::string%read_formatted proc~read_formatted->proc~get_next_non_blank_character_any_record

Contents


Source Code

   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