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
This commit is contained in:
committed by
Douglas Clowes
parent
6afa1943e2
commit
6e9684275a
23
site_ansto/TESTS/check_zlib/mkdata.c
Normal file
23
site_ansto/TESTS/check_zlib/mkdata.c
Normal file
@@ -0,0 +1,23 @@
|
||||
#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);
|
||||
}
|
||||
Reference in New Issue
Block a user