NCEPLIBS-bufr 11.7.1
cread.c File Reference

C language interface for reading or writing BUFR messages. More...

#include "bufrlib.h"
#include "cread.h"

Go to the source code of this file.

Functions

void backbufr (f77int *nfile)
 This subroutine backspaces a BUFR file by one BUFR message. More...
 
void cewind (f77int *nfile)
 This subroutine rewinds a BUFR file back to its beginning. More...
 
void closfb (f77int *nfile)
 This subroutine closes a previously opened BUFR file. More...
 
f77int crdbufr (f77int *nfile, char *bufr, f77int *mxbyt)
 This function reads the next message from a BUFR file that was previously opened for reading. More...
 
void cwrbufr (f77int *nfile, f77int *bufr, f77int *nwrd)
 This subroutine writes a BUFR message into a file that was previously opened for writing. More...
 
void openab (f77int *nfile, char *ufile)
 This subroutine opens a new system file for appending BUFR messages. More...
 
void openrb (f77int *nfile, char *ufile)
 This subroutine opens a new system file for reading BUFR messages. More...
 
void openwb (f77int *nfile, char *ufile)
 This subroutine opens a new system file for writing BUFR messages. More...
 

Detailed Description

C language interface for reading or writing BUFR messages.

This interface is used internally by many of the Fortran language file-reading/writing subroutines and message-reading/writing subroutines within the BUFRLIB software, in order to use C to directly read/write BUFR messages from/to system files.

This in turn eliminates the need for IEEE Fortran control words within system files, though such control words can still be included when writing BUFR messages to system files (if desired) via a previous call to subroutine setblock().

Definition in file cread.c.

Function Documentation

◆ backbufr()

void backbufr ( f77int *  nfile)

This subroutine backspaces a BUFR file by one BUFR message.

Author
J. Woollen
Date
2012-09-15
Parameters
[in]nfile– f77int*: Internal Fortran I/O stream index associated with BUFR file

Program history log:

Date Programmer Comments
2012-09-15 J. Woollen Original author
2014-11-07 J. Ator Allow dynamic allocation of pb and lstpos arrays

Definition at line 84 of file cread.c.

References lstpos, and pb.

Referenced by cpdxmm(), posapx(), rdbfdx(), readmg(), and ufbmem().

◆ cewind()

void cewind ( f77int *  nfile)

This subroutine rewinds a BUFR file back to its beginning.

Author
J. Woollen
Date
2012-09-15
Parameters
[in]nfile– f77int*: Internal Fortran I/O stream index associated with BUFR file

Program history log:

Date Programmer Comments
2012-09-15 J. Woollen Original author
2014-11-07 J. Ator Allow dynamic allocation of pb array

Definition at line 100 of file cread.c.

References pb.

Referenced by rewnbf(), ufbmem(), and ufbpos().

◆ closfb()

void closfb ( f77int *  nfile)

This subroutine closes a previously opened BUFR file.

Author
J. Woollen
Date
2012-09-15
Parameters
[in]nfile– f77int*: Internal Fortran I/O stream index associated with BUFR file

Program history log:

Date Programmer Comments
2012-09-15 J. Woollen Original author
2014-11-07 J. Ator Allow dynamic allocation of pb array

Definition at line 116 of file cread.c.

References pb.

Referenced by closbf().

◆ crdbufr()

f77int crdbufr ( f77int *  nfile,
char *  bufr,
f77int *  mxbyt 
)

This function reads the next message from a BUFR file that was previously opened for reading.

Author
J. Woollen
Date
2012-09-15
Parameters
[in]nfile– f77int*: Internal Fortran I/O stream index associated with BUFR file
[out]bufr– char*: BUFR message
[in]mxbyt– f77int*: Dimensioned size (in bytes) of bufr; used by the function to ensure that it doesn't overflow the BUFR array
Returns
crdbufr – f77int: return code
  • 0 = normal return
  • -1 = end-of-file encountered while reading
  • -2 = I/O error encountered while reading
  • -3 = overflow of bufr array

Program history log:

Date Programmer Comments
2012-09-15 J. Woollen Original author
2014-11-07 J. Ator Allow dynamic allocation of pb and lstpos arrays

Definition at line 140 of file cread.c.

References iupbs01(), lstpos, and pb.

◆ cwrbufr()

void cwrbufr ( f77int *  nfile,
f77int *  bufr,
f77int *  nwrd 
)

This subroutine writes a BUFR message into a file that was previously opened for writing.

Author
J. Woollen
Date
2012-09-15
Parameters
[in]nfile– f77int*: Internal Fortran I/O stream index associated with BUFR file
[in]bufr– f77int*: BUFR message
[in]nwrd– f77int*: Size (in f77ints) of bufr

Program history log:

Date Programmer Comments
2012-09-15 J. Woollen Original author
2014-11-07 J. Ator Allow dynamic allocation of pb array

Definition at line 173 of file cread.c.

References pb.

Referenced by msgwrt().

◆ openab()

void openab ( f77int *  nfile,
char *  ufile 
)

This subroutine opens a new system file for appending BUFR messages.

Author
J. Woollen
Date
2012-09-15
Parameters
[in]nfile– f77int*: Internal Fortran I/O stream index associated with ufile
[in]ufile– char*: [path/]name of system file to be opened

Program history log:

Date Programmer Comments
2012-09-15 J. Woollen Original author
2014-11-07 J. Ator Allow dynamic allocation of pb array

Definition at line 68 of file cread.c.

References pb.

Referenced by openbf().

◆ openrb()

void openrb ( f77int *  nfile,
char *  ufile 
)

This subroutine opens a new system file for reading BUFR messages.

Author
J. Woollen
Date
2012-09-15
Parameters
[in]nfile– f77int*: Internal Fortran I/O stream index associated with ufile
[in]ufile– char*: [path/]name of system file to be opened

Program history log:

Date Programmer Comments
2012-09-15 J. Woollen Original author
2014-11-07 J. Ator Allow dynamic allocation of pb array

Definition at line 34 of file cread.c.

References pb.

Referenced by openbf().

◆ openwb()

void openwb ( f77int *  nfile,
char *  ufile 
)

This subroutine opens a new system file for writing BUFR messages.

Author
J. Woollen
Date
2012-09-15
Parameters
[in]nfile– f77int*: Internal Fortran I/O stream index associated with ufile
[in]ufile– char*: [path/]name of system file to be opened

Program history log:

Date Programmer Comments
2012-09-15 J. Woollen Original author
2014-11-07 J. Ator Allow dynamic allocation of pb array

Definition at line 51 of file cread.c.

References pb.

Referenced by openbf().