#include #include #include #define DATALENGTH 1024*1024*16 /* Will read upto 16M integers from a file. * This expects the file to contain a sequence of * ints starting at 0, (eg 0 1 2 3 ..) and flags an * error if any of the ints don't match the expected sequence. * This has been tested on compressed and uncompressed files * containing 1 to 16M ints. */ main(int argc, char *argv[]) { int i,n, error=0; int rdata[DATALENGTH]; gzFile *fp; if (argc<2) { printf("You must supply a file name\n"); exit(1); } if ((fp=gzopen(argv[1], "rb")) == NULL) { printf ("Couldn't open file for reading\n"); exit(1); } n=gzread(fp, rdata, DATALENGTH*sizeof(int)); printf("Read %d bytes, ie %d ints\n", n, n/sizeof(int)); for (i=0; i