Skip to main content

gzfwrite

Function gzfwrite 

Source
pub unsafe extern "C" fn gzfwrite(
    buf: *const c_void,
    size: size_t,
    nitems: size_t,
    file: gzFile,
) -> size_t
Available on crate feature gz only.
Expand description

Compress and write nitems items of size size from buf to file, duplicating the interface of C stdio’s fwrite, with size_t request and return types.

§Returns

  • The number of full items written of size size on success.
  • Zero on error.

Note: If the multiplication of size and nitems overflows, i.e. the product does not fit in a size_t, then nothing is written, zero is returned, and the error state is set to Z_STREAM_ERROR.

§Safety

  • file, if non-null, must be an open file handle obtained from gzopen or gzdopen.
  • The caller must ensure that buf points to at least size * nitems readable bytes.