subroutine f_mkdir(path,ierr)
implicit none
character(len=*), intent(in) :: path
integer, intent(inout) :: ierr
character(kind=C_CHAR,len=1), allocatable :: c_path(:)
integer :: length,i
!---------------------------------------------
! To convert C string,
! add a null terminator to the fortran string
!---------------------------------------------
length = LEN(TRIM(ADJUSTL(path)))+1
allocate(c_path(length))
do i=1,length-1
c_path(i) = path(i:i)
enddo
c_path(length) = C_NULL_CHAR
call pf_mkdir(c_path,ierr)
deallocate(c_path)
return
end subroutine