34 g2int k,k4,ipos,nread,lim,start,vers,lengrib;
40 cbuf=(
unsigned char *)malloc(mseek);
47 while (*lgrib==0 && nread==mseek) {
51 fseek(lugb,ipos,SEEK_SET);
52 nread=fread(cbuf,
sizeof(
unsigned char),mseek,lugb);
58 gbit(cbuf,&start,(k+0)*8,4*8);
59 gbit(cbuf,&vers,(k+7)*8,1*8);
60 if (start==1196575042 && (vers==1 || vers==2)) {
62 if (vers == 1)
gbit(cbuf,&lengrib,(k+4)*8,3*8);
63 if (vers == 2)
gbit(cbuf,&lengrib,(k+12)*8,4*8);
64 fseek(lugb,ipos+k+lengrib-4,SEEK_SET);
66 k4=fread(&end,4,1,lugb);
67 if (k4 == 1 && end == 926365495) {
void gbit(unsigned char *in, g2int *iout, g2int iskip, g2int nbyte)
Get bits - unpack bits: Extract arbitrary size values from a packed bit string, right justifying each...
Header file for NCEPLIBS-g2c library.
int64_t g2int
Long integer type.
void seekgb(FILE *lugb, g2int iseek, g2int mseek, g2int *lskip, g2int *lgrib)
This subprogram searches a file for the next GRIB Message.