File: open_netcdf.c

package info (click to toggle)
ecmwflibs 2%3A0.6.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 388 kB
  • sloc: python: 720; sh: 536; cpp: 30; ansic: 16; makefile: 10
file content (22 lines) | stat: -rw-r--r-- 431 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

#include <stdio.h>
#include <stdlib.h>
#include <netcdf.h>

int main(int argc, const char* argv[]) {
    int ncid, e;

    if (argc != 2) {
        fprintf(stderr, "Usage: %s file.nc\n", argv[0]);
        exit(1);
    }

    if ((e = nc_open(argv[1], NC_NOWRITE, &ncid))) {
        fprintf(stderr,"%s: %s\n", argv[1], nc_strerror(e));
        exit(1);
    }

    printf("%s: file opened successfully\n", argv[1]);

    exit(0);
}