24 lines
468 B
C
24 lines
468 B
C
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include <zlib.h>
|
|
|
|
#define DATALENGTH 1024*64
|
|
|
|
/* Writes an int array to a gzipped file
|
|
* This has been tested with arrays from 1 to 16M integers.
|
|
*/
|
|
main() {
|
|
int i;
|
|
int data[DATALENGTH];
|
|
gzFile *fp;
|
|
|
|
if ((fp=gzopen("data.gz", "wb")) == NULL) {
|
|
printf ("Couldn't open file for writing\n");
|
|
exit(1);
|
|
}
|
|
for (i=0; i<DATALENGTH; i++)
|
|
data[i]=i;
|
|
gzwrite(fp, data, DATALENGTH*sizeof(int));
|
|
gzclose(fp);
|
|
}
|