devela::_dep::nc::call

Function open

pub unsafe fn open<P>(filename: P, flags: i32, mode: u32) -> Result<i32, i32> 
where P: AsRef<Path>,
Available on crate feature dep_nc only.
Expand description

Open and possibly create a file.

§Examples

let path = "/etc/passwd";
let ret = unsafe { nc::open(path, nc::O_RDONLY, 0) };
assert!(ret.is_ok());
let fd = ret.unwrap();
let ret = unsafe { nc::close(fd) };
assert!(ret.is_ok());