Function nc::pread64 [−][src]
pub fn pread64(
fd: i32,
buf: usize,
count: usize,
offset: off_t
) -> Result<ssize_t, Errno>
Expand description
Read from a file descriptor without changing file offset.
let path = "/etc/passwd";
let ret = nc::open(path, nc::O_RDONLY, 0);
assert!(ret.is_ok());
let fd = ret.unwrap();
let mut buf = [0_u8; 128];
let read_count = 64;
let ret = nc::pread64(fd, buf.as_mut_ptr() as usize, read_count, 0);
assert!(ret.is_ok());
assert_eq!(ret, Ok(read_count as nc::ssize_t));
assert!(nc::close(fd).is_ok());