File: rewrite-scalar.c

package info (click to toggle)
netcdf-parallel 1%3A4.7.4-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 105,352 kB
  • sloc: ansic: 229,114; sh: 11,180; yacc: 2,561; makefile: 1,390; lex: 1,173; xml: 173; awk: 2
file content (28 lines) | stat: -rw-r--r-- 885 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*********************************************************************
 * This is part of the Unidata netCDF package.
 * Copyright 2018, UCAR/Unidata
 * See COPYRIGHT file for copying and redistribution conditions.
 *
 * This program is part of the testing of file lengths done by the
 * test script tst_lentghs.sh.
 *
 * $Id: rewrite-scalar.c,v 1.3 2008/10/20 01:48:08 ed Exp $
 *********************************************************************/

#include "config.h"
#include <stdio.h>
#include <netcdf.h>

#define ERR do {fflush(stdout); fprintf(stderr, "Error, %s, line: %d\n", __FILE__, __LINE__); return(1);} while (0)

int
main(int ac, char *av[]) {
    int ncid, varid, data[] = {42};

    if (nc_open(av[1], NC_WRITE, &ncid)) ERR;
    if (nc_inq_varid(ncid, av[2], &varid)) ERR;
    if (nc_put_var_int(ncid, varid, data)) ERR;
    if (nc_close(ncid)) ERR;

    return 0;
}