devela::_dep::nc

Function symlinkat

pub unsafe fn symlinkat<P>(
    old_name: P,
    new_dirfd: i32,
    new_name: P,
) -> Result<(), i32> 
where P: AsRef<Path>,
Available on crate feature dep_nc only.
Expand description

Make a new name for a file.

§Examples

let oldname = "/etc/passwd";
let newname = "/tmp/nc-symlinkat";
let ret = unsafe { nc::symlinkat(oldname, nc::AT_FDCWD, newname) };
assert!(ret.is_ok());
let ret = unsafe { nc::unlinkat(nc::AT_FDCWD, newname, 0) };
assert!(ret.is_ok());