read_unformatted Subroutine

private subroutine read_unformatted(string, unit, iostat, iomsg)

Read a character sequence from a connected unformatted unit into the string.

Arguments

Type IntentOptional Attributes Name
type(string_type), intent(inout) :: string
integer, intent(in) :: unit
integer, intent(out) :: iostat
character(len=*), intent(inout) :: iomsg

Called by

proc~~read_unformatted~~CalledByGraph proc~read_unformatted read_unformatted interface~read (unformatted) read (unformatted) interface~read (unformatted)->proc~read_unformatted

Variables

Type Visibility Attributes Name Initial
character(len=:), private, allocatable :: buffer
integer(kind=long), private :: chunk

Source Code

subroutine read_unformatted(string, unit, iostat, iomsg)
   type(string_type), intent(inout) :: string
   integer, intent(in)    :: unit
   integer, intent(out)   :: iostat
   character(len=*), intent(inout) :: iomsg
   character(len=:), allocatable :: buffer
   integer(long) :: chunk

   read (unit, iostat=iostat, iomsg=iomsg) chunk
   if (iostat == 0) then
      allocate (character(len=chunk) :: buffer)
      read (unit, iostat=iostat, iomsg=iomsg) buffer
      string%raw = buffer
   end if

end subroutine read_unformatted