1*42607086SCameron Smith module chdir_mod 2*42607086SCameron Smith implicit none 3*42607086SCameron Smith interface 4*42607086SCameron Smith integer function c_chdir(path) bind(C, name="chdir") 5*42607086SCameron Smith use iso_c_binding 6*42607086SCameron Smith character(c_char) :: path(*) 7*42607086SCameron Smith end function 8*42607086SCameron Smith end interface 9*42607086SCameron Smith contains 10*42607086SCameron Smith subroutine chdir(path, err) 11*42607086SCameron Smith use iso_c_binding 12*42607086SCameron Smith character(len=*) :: path 13*42607086SCameron Smith integer, optional, intent(out) :: err 14*42607086SCameron Smith integer :: loc_err 15*42607086SCameron Smith loc_err = c_chdir(path//c_null_char) 16*42607086SCameron Smith if( present(err) ) err = loc_err 17*42607086SCameron Smith end subroutine 18*42607086SCameron Smith end module chdir_mod 19