c2f_str Function

public function c2f_str(cstr) result(fstr)

Convert C string to Fortran

Arguments

Type IntentOptional Attributes Name
character(kind=c_char, len=1), intent(in), dimension(:) :: cstr

string from C

Return Value character(len=:), allocatable

fortran string


Called by

proc~~c2f_str~~CalledByGraph proc~c2f_str radbelt_c_module::c2f_str proc~set_data_files_paths_c radbelt_c_module::set_data_files_paths_c proc~set_data_files_paths_c->proc~c2f_str proc~set_igrf_file_path_c radbelt_c_module::set_igrf_file_path_c proc~set_igrf_file_path_c->proc~c2f_str proc~set_trm_file_path_c radbelt_c_module::set_trm_file_path_c proc~set_trm_file_path_c->proc~c2f_str

Source Code

    function c2f_str(cstr) result(fstr)

        character(kind=c_char, len=1), dimension(:), intent(in) :: cstr !! string from C
        character(len=:), allocatable :: fstr !! fortran string

        integer :: i !! counter

        fstr = ''
        do i = 1, size(cstr)
            fstr = fstr//cstr(i)
        end do
        fstr = trim(fstr)

    end function c2f_str