34int read_bufr (
unsigned char *bufr,
char *filename,
int *length )
41 if ( ( fp = fopen ( filename,
"r" ) ) == NULL )
43 fprintf ( stderr,
"cannot open file '%s'\n", filename );
44 exit ( EXIT_FAILURE );
47 while ( ( aux = fgetc ( fp ) ) != EOF && (
int ) n < *length )
58 if ( bufr[0] !=
'B' || bufr[1] !=
'U' || bufr[2] !=
'F' || bufr[3] !=
'R' )
62 if ( bufr[n - 4] !=
'7' || bufr[n - 3] !=
'7' || bufr[n - 2] !=
'7'
63 || bufr[n - 1] !=
'7' )
Include header file for binary bufr2tac.
unsigned int three_bytes_to_uint(const unsigned char *source)
returns the integer value from an array of three bytes, most significant first
int read_bufr(unsigned char *bufr, char *filename, int *length)
read a bufr file as an array of unsigned chars