The gzread() function shall read data from the compressed file referenced by file, which shall have been opened in a read mode (see gzopen() and gzdopen()). The gzread() function shall read data from file, and uncompress it into buf. At most, len bytes of uncompressed data shall be copied to buf. If the file is not compressed, gzread() shall simply copy data from file to buf without alteration.
On success, gzread() shall return the number of bytes
decompressed into buf.
If gzread() returns
either the end-of-file has been reached
or an underlying read error has occurred. Applications
should use gzerror() or gzeof()
to determine which occurred.
On other errors,
gzread() shall return a value less than
and applications may examine the cause using gzerror().
On error, gzread() shall set the error number associated with the stream identified by file to indicate the error. Applications should use gzerror() to access this error value.
An underlying base library function has indicated an error.
The global variable
errno may be examined
for further information.
End of file has been reached on input.
A CRC error occurred when reading data; the file is corrupt.
The stream is invalid, or is in an invalid state.
A dictionary is needed (see inflateSetDictionary()).
Insufficient memory available to decompress.