From a9bb8c48d7fa233651dbc79407df0a83f27bbeda Mon Sep 17 00:00:00 2001 From: Mark Adler Date: Mon, 24 Feb 2025 23:49:51 -0800 Subject: Note the use of gzungetc() to run a deferred seek while reading. --- zlib.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/zlib.h b/zlib.h index c055ecb2..1a571270 100644 --- a/zlib.h +++ b/zlib.h @@ -1549,6 +1549,11 @@ ZEXTERN int ZEXPORT gzungetc(int c, gzFile file); output buffer size of pushed characters is allowed. (See gzbuffer above.) The pushed character will be discarded if the stream is repositioned with gzseek() or gzrewind(). + + gzungetc(-1, file) will force any pending seek to execute. Then gztell() + will report the position, even if the requested seek reached end of file. + This can be used to determine the number of uncompressed bytes in a gzip + file without having to read it into a buffer. */ ZEXTERN int ZEXPORT gzflush(gzFile file, int flush); -- cgit v1.2.3-55-g6feb