Files
sics/site_ansto/TESTS/check_zlib/mkdata.c
Ferdi Franceschini 6e9684275a Test code for checking suitability of zlib for reading and writing compressed data.
r1490 | ffr | 2007-02-15 10:05:00 +1100 (Thu, 15 Feb 2007) | 2 lines
2012-11-15 12:59:08 +11:00

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);
}