NCEPLIBS-g2c  1.7.0
seekgb.c File Reference

Searches a file for the next GRIB message. More...

#include <stdio.h>
#include <stdlib.h>
#include "grib2_int.h"

Go to the source code of this file.

Macros

#define BITS_PER_BYTE   8
 8 bits per byte. More...
 

Functions

void seekgb (FILE *lugb, g2int iseek, g2int mseek, g2int *lskip, g2int *lgrib)
 This subprogram searches a file for the next GRIB Message. More...
 

Detailed Description

Searches a file for the next GRIB message.

Author
Stephen Gilbert
Date
2002-10-28

Definition in file seekgb.c.

Macro Definition Documentation

◆ BITS_PER_BYTE

#define BITS_PER_BYTE   8

8 bits per byte.

Definition at line 10 of file seekgb.c.

Function Documentation

◆ seekgb()

void seekgb ( FILE *  lugb,
g2int  iseek,
g2int  mseek,
g2int lskip,
g2int lgrib 
)

This subprogram searches a file for the next GRIB Message.

The search is done starting at byte offset iseek of the file referenced by lugb for mseek bytes at a time. If found, the starting position and length of the message are returned in lskip and lgrib, respectively. The search is terminated when an EOF or I/O error is encountered.

Program History Log

Date Programmer Comments
2002-10-28 GILBERT Modified from Iredell's skgb subroutine
2009-01-16 VUONG Changed lskip to 4 instead of sizof(g2int)
Parameters
lugbFILE pointer for the file to search. File must be opened before this routine is called.
iseeknumber of bytes in the file to skip before search.
mseeknumber of bytes to search at a time (must be at least 16).
lskipnumber of bytes to skip from the beggining of the file to where the GRIB message starts.
lgribnumber of bytes in message (set to 0, if no message found).
Author
Stephen Gilbert
Date
2002-10-28

Definition at line 39 of file seekgb.c.

References BITS_PER_BYTE, and gbit().