Name

gzrewind — Resets the file-position on a compressed file stream.


Library

Libz.lib


Synopsis

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

Return Value

On success, gzrewind() shall return 0. On error, gzrewind() shall return -1, and may set the error value for file accordingly.


Detailed Description

The gzrewind() function shall set the starting position for the next read on compressed file stream file to the beginning of file. file must be open for reading.

gzrewind() is equivalent to (int) gzseek (file, 0L, SEEK_SET).

Examples

To reset the file-position on a compressed file stream:

#include <stdio.h> 
#include <zlib.h>
void Gzrewind( )
{   
    int len = (int)strlen(hello)+1; 
    gzFile file;
    const char * fname = TESTFILE;
    file = gzopen(fname, "rb");
    gzputc(file, 'h');
    gzrewind(file);
    gzclose(file);   
}

Errors

On error, gzrewind() shall return -1, indicating that file is NULL, or does not represent an open compressed file stream, or represents a compressed file stream that is open for writing and is not currently at the beginning of file.


Feedback

For additional information or queries on this page send feedback

© 2005-2007 Nokia

Top