devela::_dep::nc

Function fchdir

pub unsafe fn fchdir(fd: i32) -> Result<(), i32> 
Available on crate feature dep_nc only.
Expand description

Change working directory.

§Examples

let path = "/tmp";
// Open folder directly.
let fd = unsafe { nc::openat(nc::AT_FDCWD, path, nc::O_PATH, 0) };
assert!(fd.is_ok());
let fd = fd.unwrap();
let ret = unsafe { nc::fchdir(fd) };
assert!(ret.is_ok());
let ret = unsafe { nc::close(fd) };
assert!(ret.is_ok());