Function nc::creat [−][src]
pub fn creat<P: AsRef<Path>>(filename: P, mode: mode_t) -> Result<i32, Errno>
Expand description
Create a file.
equals to call open()
with flags O_CREAT|O_WRONLY|O_TRUNC
.
let path = "/tmp/nc-creat-file";
let fd = nc::creat(path, 0o644);
assert!(fd.is_ok());
let fd = fd.unwrap();
assert!(nc::close(fd).is_ok());
assert!(nc::unlink(path).is_ok());