read a file that is single string of ints into a vector
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | filename |
function read_file_to_int_vec(filename) result(array) !! read a file that is single string of ints into a vector character(len=*),intent(in) :: filename integer,dimension(:),allocatable :: array integer :: i, iunit, n_lines, n_cols character(len=:),allocatable :: line open(newunit=iunit, file=filename, status='OLD') line = read_line(iunit) allocate(array(len(line))) do i = 1, size(array) read(line(i:i),'(*(I1))') array(i) end do close(iunit) end function read_file_to_int_vec