-
Notifications
You must be signed in to change notification settings - Fork 293
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,5 @@ dependencies: | |
# PNetCDF (build 109) | ||
# - libnetcdf | ||
- netcdf4 | ||
# - vc # [win] | ||
- gcc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#include <netcdf.h> | ||
#include <stdio.h> | ||
#include <string.h> | ||
|
||
/* This macro handles errors by outputting a message to stdout and | ||
then exiting. */ | ||
#define NC_EXAMPLE_ERROR 2 /* This is the exit code for failure. */ | ||
#define BAIL(e) do { \ | ||
printf("Bailing out in file %s, line %d, error:%s.\n", \ | ||
__FILE__, __LINE__, nc_strerror(e)); \ | ||
return NC_EXAMPLE_ERROR; \ | ||
} while (0) | ||
|
||
int main() { | ||
int res, ncid; | ||
res = nc_create("test_netcdf_c.nc", NC_CLOBBER, &ncid); | ||
if (res) { | ||
BAIL(res); | ||
} | ||
printf("SUCCESS!\n"); | ||
return 0; | ||
} |