Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function read_list(InputFile) result (List)
- type(Line), pointer :: List
- ~ character(*), intent(in) :: InputFile
- ~ integer :: in
- ~
- ~ open (file=InputFile, encoding=E_, newunit=in)
- ~ List => read_line(InputFile)
- ~ close(in)
- ~ end function read_list
- ~
- ~ recursive function read_line(in) result (srcLine)
- ~ type(Line), pointer :: srcLine
- ~ character(*), intent(in) :: in
- ~ integer, parameter :: max_len = 1024
- ~ character(max_len,CH_) :: string
- ~ integer :: IO
- ~
- ~
- ~ read(in,"(a)",iostat=IO) string
- ~ call Handle_IO_Status(IO,"reading line from file")
- ~ if (IO == 0) then
- ~ allocate(srcLine)
- ~ srcLine%str = Trim(string)
- ~ srcLine%next = read_line(in)
- ~ else
- ~ srcLine => Null()
- ~ end if
- end function read_line
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement