48 g2int k, k4, ipos, nread, lim, start, vers, lengrib;
52 LOG((3,
"seekgb iseek %ld mseek %ld", iseek, mseek));
55 cbuf = (
unsigned char *)malloc(mseek);
60 while (*lgrib == 0 && nread == mseek)
63 fseek(lugb, ipos, SEEK_SET);
64 nread = fread(cbuf,
sizeof(
unsigned char), mseek, lugb);
68 for (k = 0; k < lim; k++)
78 if (start == 1196575042 && (vers == 1 || vers == 2))
85 LOG((4,
"lengrib %ld", lengrib));
88 fseek(lugb, ipos + k + lengrib - 4, SEEK_SET);
89 k4 = fread(&end, 4, 1, lugb);
92 if (k4 == 1 && end == 926365495)
97 LOG((4,
"found end of message lengrib %ld", lengrib));
void gbit(unsigned char *in, g2int *iout, g2int iskip, g2int nbits)
Get arbitrary size values from a packed bit string, right justifying each value in the unpacked iout ...
void seekgb(FILE *lugb, g2int iseek, g2int mseek, g2int *lskip, g2int *lgrib)
Search a file for the next GRIB Message.