34void openrb (nfile,ufile) f77int *nfile;
char *ufile; {
pb[*nfile] = fopen( ufile ,
"rb " ); }
51void openwb (nfile,ufile) f77int *nfile;
char *ufile; {
pb[*nfile] = fopen( ufile ,
"wb " ); }
68void openab (nfile,ufile) f77int *nfile;
char *ufile; {
pb[*nfile] = fopen( ufile ,
"a+b" ); }
100void cewind (nfile ) f77int *nfile; { rewind(
pb[*nfile]); }
116void closfb (nfile ) f77int *nfile; { fclose(
pb[*nfile]); }
141f77int *nfile; f77int *mxbyt;
char *bufr;
142{ f77int nbyt; f77int nb; f77int wkint[2]; fpos_t nxtpos;
143 fgetpos(
pb[*nfile],&
lstpos[*nfile]);
144 nb =
sizeof(*bufr); bufr[0]=bufr[1];
145 while ( strncmp(bufr,
"BUFR",4)!=0)
146 { memmove(bufr,&bufr[1],3);
147 if(fread(bufr+3,nb,1,
pb[*nfile])!=1)
return -1;
149 fgetpos(
pb[*nfile],&nxtpos);
if(fread(bufr+4,nb,4,
pb[*nfile])!=4)
return -1;
150 memcpy(wkint,bufr,8); nbyt=
iupbs01(wkint,
"LENM",4)-8;
151 if(nbyt+8>*mxbyt) {fsetpos(
pb[*nfile],&nxtpos);
return -3;};
152 if(fread(bufr+8,nb,nbyt,
pb[*nfile])!=nbyt) {fsetpos(
pb[*nfile],&nxtpos);
return -2;};
153 if(strncmp(bufr+nbyt+4,
"7777",4)!=0) {fsetpos(
pb[*nfile],&nxtpos);
return -2;};
174f77int *nfile; f77int *nwrd; f77int *bufr;
175{ f77int nb; nb =
sizeof(*bufr);
176 fwrite(bufr,nb,*nwrd,
pb[*nfile]);
Define signatures to enable a number of BUFRLIB subprograms to be called directly from C application ...
void openrb(f77int *nfile, char *ufile)
This subroutine opens a new system file for reading BUFR messages.
void cewind(f77int *nfile)
This subroutine rewinds a BUFR file back to its beginning.
f77int crdbufr(f77int *nfile, char *bufr, f77int *mxbyt)
This function reads the next message from a BUFR file that was previously opened for reading.
void openwb(f77int *nfile, char *ufile)
This subroutine opens a new system file for writing BUFR messages.
void cwrbufr(f77int *nfile, f77int *bufr, f77int *nwrd)
This subroutine writes a BUFR message into a file that was previously opened for writing.
void closfb(f77int *nfile)
This subroutine closes a previously opened BUFR file.
void backbufr(f77int *nfile)
This subroutine backspaces a BUFR file by one BUFR message.
void openab(f77int *nfile, char *ufile)
This subroutine opens a new system file for appending BUFR messages.
Define signatures and declare variables for reading or writing BUFR messages via a C language interfa...
fpos_t * lstpos
Byte positions of last successful reads from files corresponding to pb, for files that were opened fo...
function iupbs01(MBAY, S01MNEM)
This function returns a specified value from within Section 0 or Section 1 of a BUFR message.