Function nc::pwrite64[][src]

pub fn pwrite64(
    fd: i32,
    buf: usize,
    count: size_t,
    offset: off_t
) -> Result<ssize_t, Errno>
Expand description

Write to a file descriptor without changing file offset.

let path = "/tmp/nc-pwrite64";
let ret = nc::open(path, nc::O_WRONLY | nc::O_CREAT, 0o644);
assert!(ret.is_ok());
let fd = ret.unwrap();
let buf = "Hello, Rust";
let ret = nc::pwrite64(fd, buf.as_ptr() as usize, buf.len(), 0);
assert!(ret.is_ok());
assert_eq!(ret, Ok(buf.len() as nc::ssize_t));
assert!(nc::close(fd).is_ok());
assert!(nc::unlink(path).is_ok());