#include #include #include #ifndef BUFSIZE #define BUFSIZE BUFSIZ #endif int main() { char buf[BUFSIZE]; gzFile gz = gzdopen(fileno(stdout), "w9"); assert(gz); int n; while ((n = fread(buf, 1, sizeof(buf), stdin))) { int m = gzwrite(gz, buf, n); assert(n == m); gzflush(gz, Z_SYNC_FLUSH); } gzclose(gz); return 0; }