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. |
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed arrows point from an interface to procedures which implement that interface. This could include the module procedures in a generic interface or the implementation in a submodule of an interface in a parent module.
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
return
!---------------------------------------------------------------------------------------------------------------------------------
endsubroutine get_next_non_blank_character_this_record