1 /*
2 * Name: readbz.c
3 * Author: Pietro Belotti
4 * Purpose: check that bzgetXXX functions work
5 *
6 * This code is published under the Eclipse Public License (EPL).
7 * See http://www.eclipse.org/legal/epl-v10.html
8 */
9
10 #include <bzlib.h>
11 #include <stdio.h>
12 #include <stdlib.h>
13 #include <string.h>
14
15 #include "lpio.h"
16 #include "misc.h"
17
18 /* #define MAX_STR 50000 */
19
20 /**********************************/
21
main(int argc,char ** argv)22 int main (int argc, char **argv) {
23
24 int i;
25
26 for (i=1; i<argc; i++) {
27
28 int status;
29 double x;
30 /*char c;*/
31
32 BZFILE *bzf;
33 FILE *f;
34
35 fprintf (stderr, "reading %s\n", argv [i]);
36
37 f = fopen (argv [i], "r");
38
39 bzf = BZ2_bzReadOpen( &status, f, 1, 0, NULL, 0);
40
41 do {
42 status = bzgetdbl (bzf, &x);
43 printf ("[%.10f]\n", x);
44 } while (!status);
45
46 /*
47 do {
48 status = bzgetchar (bzf, &c);
49 if (!status) printf ("%c", c);
50 } while (!status);
51 */
52
53 BZ2_bzReadClose (&status, bzf);
54 fclose (f);
55 }
56
57 return 0;
58 }
59