Function nc::openat[][src]

pub fn openat(
    dirfd: i32,
    filename: &str,
    flags: i32,
    mode: mode_t
) -> Result<i32, Errno>
Expand description

Open and possibly create a file within a directory.

let path = "/etc/passwd";
let ret = nc::openat(nc::AT_FDCWD, path, nc::O_RDONLY, 0);
assert!(ret.is_ok());
let fd = ret.unwrap();
assert!(nc::close(fd).is_ok());