Function nc::unlink

source ·
pub unsafe fn unlink<P: AsRef<Path>>(filename: P) -> Result<(), Errno>
Expand description

Delete a name and possibly the file it refers to.

§Example

let path = "/tmp/nc-unlink";
let ret = unsafe { nc::openat(nc::AT_FDCWD, path, nc::O_WRONLY | nc::O_CREAT, 0o644) };
assert!(ret.is_ok());
let fd = ret.unwrap();
let ret = unsafe { nc::close(fd) };
assert!(ret.is_ok());
let ret = unsafe { nc::unlinkat(nc::AT_FDCWD, path, 0) };;
assert!(ret.is_ok());