Function nc::ftruncate [−][src]
pub fn ftruncate(fd: i32, length: off_t) -> Result<(), Errno>
Expand description
Truncate an opened file to a specified length.
let path = "/tmp/nc-ftruncate"; let ret = nc::open(path, nc::O_WRONLY | nc::O_CREAT, 0o644); assert!(ret.is_ok()); let fd = ret.unwrap(); let ret = nc::ftruncate(fd, 64 * 1024); assert!(ret.is_ok()); assert!(nc::close(fd).is_ok()); assert!(nc::unlink(path).is_ok());