Function nc::renameat [−][src]
pub fn renameat(
olddfd: i32,
oldfilename: &str,
newdfd: i32,
newfilename: &str
) -> Result<(), Errno>
Expand description
Change name or location of a file.
let path = "/tmp/nc-renameat"; let ret = nc::open(path, nc::O_WRONLY | nc::O_CREAT, 0o644); assert!(ret.is_ok()); let fd = ret.unwrap(); assert!(nc::close(fd).is_ok()); let new_path = "/tmp/nc-renameat-new"; let ret = nc::renameat(nc::AT_FDCWD, path, nc::AT_FDCWD, new_path); assert!(ret.is_ok()); assert!(nc::unlink(new_path).is_ok());