f_c_character Subroutine

private subroutine f_c_character(rhs, lhs, len)

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: rhs
character(kind=c_char, len=1), intent(out) :: lhs(*)
integer, intent(in) :: len

Source Code

subroutine f_c_character(rhs, lhs, len)
   character(kind=c_char), intent(out) :: lhs(*)
   character(len=*), intent(in) :: rhs
   integer, intent(in) :: len
   integer :: length
   length = min(len-1, len_trim(rhs))

   lhs(1:length) = transfer(rhs(1:length), lhs(1:length))
   lhs(length+1:length+1) = c_null_char

end subroutine f_c_character