Name

gzclose — Closes the compressed file stream file.


Library

Libz.lib


Synopsis

#include <zlib.h>
int gzclose (gzFile file );

Return Value

On success, gzclose() shall return Z_OK. Otherwise, gzclose() shall return an error value as described below.


Detailed Description

The gzclose() function shall close the compressed file stream file. If file was open for writing, gzclose() shall first flush any pending output. Any state information allocated shall be freed.


Examples

To close the compressed file stream:

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

void Gzclose( )
{
const char hello[] = "hello, hello!";
int len = (int)strlen(hello)+1;
gzFile file;
const char * fname = TESTFILE;
file = gzopen(fname, "wb");
gzputc(file, 'h');
err= gzclose(file);
}

Errors

On error, gzclose() may set the global variable errno to indicate the error. The gzclose() shall return a value other than Z_OK on error.

Z_STREAM_ERROR

file was NULL (or Z_NULL), or did not refer to an open compressed file stream.

Z_ERRNO

An error occurred in the underlying base libraries, and the application should check errno for further information.

Z_BUF_ERROR

no compression progress is possible during buffer flush (see deflate()).


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