Read a file into an ip integer array (one element per line)
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | filename |
function read_file_to_integer64_array(filename) result(iarray) character(len=*),intent(in) :: filename integer(ip),dimension(:),allocatable :: iarray integer :: i, iunit, n_lines, istat open(newunit=iunit, file=filename, iostat=istat) if (istat /= 0) error stop ' error reading file' n_lines = number_of_lines_in_file(iunit) allocate(iarray(n_lines)) do i = 1, n_lines read(iunit, *) iarray(i) end do close(iunit) end function read_file_to_integer64_array