48 g2int k, k4, ipos, nread, lim, start, vers, lengrib;
53 LOG((3,
"seekgb iseek %ld mseek %ld", iseek, mseek));
56 cbuf = (
unsigned char *)malloc(mseek);
61 while (*lgrib == 0 && nread == mseek)
64 fseek(lugb, ipos, SEEK_SET);
65 nread = fread(cbuf,
sizeof(
unsigned char), mseek, lugb);
69 for (k = 0; k < lim; k++)
79 if (start == 1196575042 && (vers == 1 || vers == 2))
86 LOG((4,
"lengrib %ld", lengrib));
89 fseek(lugb, ipos + k + lengrib - 4, SEEK_SET);
90 k4 = fread(&end, 4, 1, lugb);
93 if (k4 == 1 && end == 926365495)
98 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.