Name

gzprintf Formats and compresses the data.


Library

Libz.lib


Synopsis

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


Return Value

The gzprintf() function shall return the number of uncompressed bytes actually written, or a value less than or equal to 0 in the event of an error.


Detailed Description

The gzprintf() function shall format data as for fprintf(), and write the resulting string to the compressed file stream file.


Examples

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

void Gzprintf( )
{
gzFile file;
const char * fname = TESTFILE ;
file = gzopen(fname, "wb");
int outlen = gzprintf(file, ", %s!", "hello");
printf("length of the output is %d",outlen);
gzclose(file);
}

Output

Length of the output is 8. 

Errors

If file is NULL, or refers to a compressed file stream that has not been opened for writing, gzprintf() shall return Z_STREAM_ERROR. Otherwise, errors are as for gzwrite().


Feedback

For additional information or queries on this page send feedback

 

© 2005-2007 Nokia

Top