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