1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
crate::ix!();
#[cfg(WIN32)]
pub fn truncate_file(
file: *mut libc::FILE,
length: u32) -> bool {
chsize(fileno(file),length) == 0
}
#[cfg(not(WIN32))]
pub fn truncate_file(
file: *mut libc::FILE,
length: u32) -> bool {
unsafe {
ftruncate(libc::fileno(file),length.into()) == 0
}
}