simplified
This commit is contained in:
parent
519ca6f990
commit
0cf0112029
|
@ -156,8 +156,8 @@ end function getUserName
|
|||
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
!> @brief convert C string to Fortran string
|
||||
!> @details: C string is NULL terminated and, hence, longer by one than the Fortran string
|
||||
!> @brief Convert C string to Fortran string.
|
||||
!> @details: C string is NULL terminated and, hence, longer by one than the Fortran string.
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
pure function c_f_string(c_string) result(f_string)
|
||||
|
||||
|
@ -181,21 +181,16 @@ end function c_f_string
|
|||
|
||||
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
!> @brief convert Fortran string to C string
|
||||
!> @details: C string is NULL terminated and, hence, longer by one than the Fortran string
|
||||
!> @brief Convert Fortran string to C string.
|
||||
!> @details: C string is NULL terminated and, hence, longer by one than the Fortran string.
|
||||
!--------------------------------------------------------------------------------------------------
|
||||
pure function f_c_string(f_string) result(c_string)
|
||||
|
||||
character(len=*), intent(in) :: f_string
|
||||
character(kind=C_CHAR), dimension(len_trim(f_string)+1) :: c_string
|
||||
|
||||
integer :: i
|
||||
|
||||
|
||||
do i=1,len_trim(f_string)
|
||||
c_string(i)=f_string(i:i)
|
||||
enddo
|
||||
c_string(len_trim(f_string)+1) = C_NULL_CHAR
|
||||
c_string = transfer(trim(f_string)//C_NULL_CHAR,c_string,size=size(c_string))
|
||||
|
||||
end function f_c_string
|
||||
|
||||
|
|
Loading…
Reference in New Issue