Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Test function testing strings.
- int rv, ncid;
- if(rv = nc_create(fname, NC_NETCDF4, &ncid))
- goto error; // Error opening file.
- char *string = malloc(250);
- sprintf(string, "This is a string.");
- nc_put_att_string(ncid, NC_GLOBAL, "string1", 1, &string);
- char *string2 = "This is also a string";
- nc_put_att_string(ncid, NC_GLOBAL, "string2", 1, &string2);
- free(string);
- nc_close(ncid);
- return rv;
- /******* nc_open call: ********/
- // Open the netCDF file.
- if(rv = nc_open(fname, NC_NOWRITE, &ncid))
- goto error;
- /******* nc_close call: ********/
- if(ncid >= 0)
- nc_close(ncid);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement