Hi all,

In the previous email I sent.  The line 
printf("version number:%s\n", data);

should be
printf("version number:%f\n", data);

the %s was a type-o, so my problem isn't that I accidentally tried to print it as a string ;)

-Dustin-

previous message:

Hi,

I need to extract info from a .gzb file.  I have read the description of gzbuilder's output file format.  I tried doing a simple extraction of the version number, which to my understanding should be the first 4 bytes in the file.  I used code like this:

gzb_extract(const char *filename) {

FILE *input;
    size_t n;
    float data;

    input = fopen(filename, "rb");
    if (input == NULL) {
        perror("gzb_extract(): couldn't open input file");
        return -1;
    }

    n = fread(&data, 1, 4, input);
    if (n != 0) {
        data = (float) ntohl((uint32_t) data); // convert to host byte order
        data /= 1000; // take out numerical constant
        printf("version number: %s\n", data);
    }

    fclose(input);
}

However, the printed results don't seem to make sense.  And a hex dump of the gzb file doesn't seem to match what my program is showing when I print out those first 4 bytes in hexadecimal.

If anyone can offer some insight or perhaps tell me if there is a flaw in the way I am trying to extract the info it would be much appreciated.  Thanks!

-Dustin-