Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Nov 21st, 2018 101 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <zlib.h>
  4.  
  5. int main(int argc, const char **argv) {
  6.     if (argc < 2) {
  7.         fprintf(stderr, "Error:  You must pass an input file\n");
  8.         exit(-1);
  9.     }
  10.  
  11.     gzFile fp = gzopen(argv[1], "r");
  12.     if (!fp) {
  13.         fprintf(stderr, "Error:  Cannot open file '%s'\n", argv[1]);
  14.         exit(-1);
  15.     }
  16.  
  17.     char buf[32768];
  18.     size_t len;
  19.  
  20.     while ((len = gzread(fp, buf, sizeof(buf))) > 0) {
  21.         buf[len] = '\0';
  22.         printf("%s", buf);
  23.     }
  24.  
  25.     gzclose(fp);
  26.  
  27.     return 0;
  28. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Pastebin PRO 'CHRISTMAS SPECIAL'!
Get 60% OFF Pastebin PRO accounts!
 
Top