Name

gzerror — Returns a string describing the last error occurred, associated with the open compressed file stream referred to by file.


Library

Libz.lib


Synopsis

#include <zlib.h>
const char * gzerror (gzFile file, int * errnum);


Return Value

The gzerror() function shall return a string that describes the last error associated with the given file compressed file stream. This string shall have the format "%s: %s", with the name of the file, followed by a colon, a space, and the description of the error. If the compressed file stream was opened by a call to gzdopen(), the format of the filename is unspecified.

Note

Rationale: Although in all current implementations of libz file descriptors are named "<fd:%d>", the code suggests that this is for debugging purposes only, and may change in a future release.

It is unspecified if the string returned is determined by the setting of the LC_MESSAGES category in the current locale.


Detailed Description

The gzerror() function shall return a string describing the last error to have occurred associated with the open compressed file stream referred to by file. It shall also set the location referenced by errnum to an integer value that further identifies the error.


Examples

#include <stdio.h>
#include <zlib.h>

void Gzerror( )
{
int len = (int)strlen(hello)+1;
gzFile file;
const char * fname = TESTFILE ;
file = gzopen(fname, "wb");
gzputc(file, 'h');
if (gzputs(file, "ello") != 5)
{
fprintf(stderr, "gzputs err: %s\n", gzerror(file, &err));
}
gzclose(file);
}

Errors

None defined.


Feedback

For additional information or queries on this page send feedback

© 2008 Nokia Corporation. All rights reserved. This documentation can be used in the connection with this Product to help and support the user.

Top