get_header_str Subroutine

private subroutine get_header_str(me, header, status_ok)

Returns the header as a character(len=*) array. (read must have already been called to read the file).

Type Bound

csv_file

Arguments

Type IntentOptional Attributes Name
class(csv_file), intent(inout) :: me
character(len=*), intent(out), dimension(:), allocatable :: header
logical, intent(out) :: status_ok

Source Code

    subroutine get_header_str(me,header,status_ok)

    implicit none

    class(csv_file),intent(inout) :: me
    character(len=*),dimension(:),allocatable,intent(out) :: header
    logical,intent(out) :: status_ok

    integer :: i !! column counter

    if (allocated(me%header)) then

        allocate(header(me%n_cols))
        do i=1,me%n_cols
            header(i) = me%header(i)%str
        end do
        status_ok = .true.

    else
        if (me%verbose) write(error_unit,'(A)') 'Error: no header in class.'
        status_ok = .false.
    end if

    end subroutine get_header_str