to_c_char_from_char Function

private pure function to_c_char_from_char(value) result(cstr)

Convert a Fortran character string to a C character array

Version: experimental

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: value

Return Value character(kind=c_char, len=1), (len(value)+1)


Called by

proc~~to_c_char_from_char~~CalledByGraph proc~to_c_char_from_char to_c_char_from_char interface~to_c_char to_c_char interface~to_c_char->proc~to_c_char_from_char

Variables

Type Visibility Attributes Name Initial
integer, private :: i
integer, private :: lv

Source Code

   pure function to_c_char_from_char(value) result(cstr)
      character(len=*), intent(in) :: value
      character(kind=c_char) :: cstr(len(value) + 1)
      integer :: i, lv
      lv = len(value)
      do i = 1, lv
         cstr(i) = value(i:i)
      end do
      cstr(lv + 1) = c_null_char
   end function to_c_char_from_char