source: lmdz_wrf/trunk/WRFV3/external/io_grib1/WGRIB/readgrib.c @ 14

Last change on this file since 14 was 1, checked in by lfita, 10 years ago
  • -- --- Opening of the WRF+LMDZ coupling repository --- -- -

WRF: version v3.3
LMDZ: version v1818

More details in:

File size: 567 bytes
Line 
1/*
2 * read_grib.c
3 *
4 * reads grib message
5 *
6 * input: pos, byte position of grib message
7 *        len_grib, length of grib message
8 * output: *buffer, grib message
9 *
10 * note: call seek_grib first
11 *
12 * v1.0 9/94 Wesley Ebisuzaki
13 *
14 */
15#include <stdio.h>
16#include <stdlib.h>
17#include <stddef.h>
18#include "grib.h"
19
20int read_grib(FILE *file, long pos, long len_grib, unsigned char *buffer) {
21
22    int i;
23
24
25    if (fseek(file, pos, SEEK_SET) == -1) {
26            return 0;
27    }
28
29    i = fread(buffer, sizeof (unsigned char), len_grib, file);
30    return (i == len_grib);
31}
Note: See TracBrowser for help on using the repository browser.