32 void openrb (nfile,ufile) f77int *nfile;
char *ufile; {
pb[*nfile] = fopen( ufile ,
"rb " ); }
47 void openwb (nfile,ufile) f77int *nfile;
char *ufile; {
pb[*nfile] = fopen( ufile ,
"wb " ); }
62 void openab (nfile,ufile) f77int *nfile;
char *ufile; {
pb[*nfile] = fopen( ufile ,
"a+b" ); }
90 void cewind (nfile ) f77int *nfile; { rewind(
pb[*nfile]); }
104 void closfb (nfile ) f77int *nfile; { fclose(
pb[*nfile]); }
127 f77int *nfile; f77int *mxbyt;
char *bufr;
128 { f77int nbyt; f77int nb; f77int wkint[2]; fpos_t nxtpos;
129 fgetpos(
pb[*nfile],&
lstpos[*nfile]);
130 nb =
sizeof(*bufr); bufr[0]=bufr[1];
131 while ( strncmp(bufr,
"BUFR",4)!=0)
132 { memmove(bufr,&bufr[1],3);
133 if(fread(bufr+3,nb,1,
pb[*nfile])!=1)
return -1;
135 fgetpos(
pb[*nfile],&nxtpos);
if(fread(bufr+4,nb,4,
pb[*nfile])!=4)
return -1;
136 memcpy(wkint,bufr,8); nbyt=
iupbs01(wkint,
"LENM",4)-8;
137 if(nbyt+8>*mxbyt) {fsetpos(
pb[*nfile],&nxtpos);
return -3;};
138 if(fread(bufr+8,nb,nbyt,
pb[*nfile])!=nbyt) {fsetpos(
pb[*nfile],&nxtpos);
return -2;};
139 if(strncmp(bufr+nbyt+4,
"7777",4)!=0) {fsetpos(
pb[*nfile],&nxtpos);
return -2;};
158 f77int *nfile; f77int *nwrd; f77int *bufr;
159 { f77int nb; nb =
sizeof(*bufr);
160 fwrite(bufr,nb,*nwrd,
pb[*nfile]);
Define signatures to enable a number of BUFRLIB subprograms to be called directly from C application ...
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.
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 cwrbufr(f77int *nfile, f77int *bufr, f77int *nwrd)
This subroutine writes a BUFR message into a file that was previously opened for writing.
FILE * pb[NFILES+1]
File pointers.
void openab(f77int *nfile, char *ufile)
This subroutine opens a new system file for appending BUFR messages.
void cewind(f77int *nfile)
This subroutine rewinds a BUFR file back to its beginning.
void openwb(f77int *nfile, char *ufile)
This subroutine opens a new system file for writing BUFR messages.
fpos_t lstpos[NFILES+1]
Byte positions of last successful reads from files corresponding to pb, for files that were opened fo...
Define signatures and declare variables for reading or writing BUFR messages via a C language interfa...
function iupbs01(MBAY, S01MNEM)
This function returns a specified value from within Section 0 or Section 1 of a BUFR message...
void openrb(f77int *nfile, char *ufile)
This subroutine opens a new system file for reading BUFR messages.