summaryrefslogtreecommitdiffstats
path: root/examples/h5_group.c
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1998-08-31 19:21:23 (GMT)
committerRobb Matzke <matzke@llnl.gov>1998-08-31 19:21:23 (GMT)
commit2ab2e14bb59d6ae7013bba9458e9f5a3b5cc2d1a (patch)
treec23cdadb45857e5e8549bb14fd057db63cce7c26 /examples/h5_group.c
parent473452205dcc08055486d29b6dc5f36670c3ceb5 (diff)
downloadhdf5-2ab2e14bb59d6ae7013bba9458e9f5a3b5cc2d1a.zip
hdf5-2ab2e14bb59d6ae7013bba9458e9f5a3b5cc2d1a.tar.gz
hdf5-2ab2e14bb59d6ae7013bba9458e9f5a3b5cc2d1a.tar.bz2
[svn-r635] Changes since 19980831
---------------------- ./Makefile.in Running `make distclean' will not fail if one of the subdirectories has already been cleaned. ./config/BlankForm ./config/irix5.3 Cleaned it up more. Added better support/documentation for systems that have more than one compiler. ./config/alpha-dec-osf4.0 [NEW] Added a new config file as a result of testing on Jim Reus's machine. ./test/chunk.c Scaled down the testing range so we can actually run it interactively. ./tools/h5import.c Included <unistd.h> to get rid of warning for close(). ./src/H5detect.c Seg-faults on Linux for some reason when NDEBUG is defined, so I just undef it at the top of the source. ./test/big.c Added a fflush(). ./tools/h5ls.c The `-d' flag now works even when `-v' isn't specified. ./examples/h5_chunk_read.c ./examples/h5_compound.c ./examples/h5_extend_write.c ./examples/h5_group.c ./examples/h5_read.c ./examples/h5_write.c Indented according to hdf5 standards. Fixed compiler warnings
Diffstat (limited to 'examples/h5_group.c')
-rw-r--r--examples/h5_group.c205
1 files changed, 103 insertions, 102 deletions
diff --git a/examples/h5_group.c b/examples/h5_group.c
index 6e34e98..1c5ab12 100644
--- a/examples/h5_group.c
+++ b/examples/h5_group.c
@@ -10,108 +10,109 @@
#define FILE "DIR.h5"
#define RANK 2
-main()
+int
+main(void)
{
- hid_t file, dir;
- hid_t dataset, dataspace;
-
- herr_t status;
- hsize_t dims[2];
- hsize_t size[1];
-
-/*
- * Create a file.
- */
-file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
-
-/*
- * Create two groups in a file.
- */
-dir = H5Gcreate(file, "/IntData", 0);
-status = H5Gclose(dir);
-
-dir = H5Gcreate(file,"/FloatData", 0);
-status = H5Gclose(dir);
-
-/*
- * Create dataspace for the character string
- */
-size[0] = 80;
-dataspace = H5Screate_simple(1, size, NULL);
-
-/*
- * Create dataset "String" in the root group.
- */
-dataset = H5Dcreate(file, "String", H5T_NATIVE_CHAR, dataspace, H5P_DEFAULT);
-H5Dclose(dataset);
-
-/*
- * Create dataset "String" in the /IntData group.
- */
-dataset = H5Dcreate(file, "/IntData/String", H5T_NATIVE_CHAR, dataspace,
- H5P_DEFAULT);
-H5Dclose(dataset);
-
-/*
- * Create dataset "String" in the /FloatData group.
- */
-dataset = H5Dcreate(file, "/FloatData/String", H5T_NATIVE_CHAR, dataspace,
- H5P_DEFAULT);
-H5Sclose(dataspace);
-H5Dclose(dataset);
-
-/*
- * Create IntArray dataset in the /IntData group by specifying full path.
- */
-dims[0] = 2;
-dims[1] = 3;
-dataspace = H5Screate_simple(RANK, dims, NULL);
-dataset = H5Dcreate(file, "/IntData/IntArray", H5T_NATIVE_INT, dataspace,
- H5P_DEFAULT);
-H5Sclose(dataspace);
-H5Dclose(dataset);
-
-/*
- * Set current group to /IntData and attach to the dataset String.
- */
-
-status = H5Gset (file, "/IntData");
-dataset = H5Dopen(file, "String");
-if (dataset > 0) printf("String dataset in /IntData group is found\n");
-H5Dclose(dataset);
-
-/*
- * Set current group to /FloatData.
- */
-status = H5Gset (file, "/FloatData");
-
-/*
- * Create two datasets FlatArray and DoubleArray.
- */
-
-dims[0] = 5;
-dims[1] = 10;
-dataspace = H5Screate_simple(RANK, dims, NULL);
-dataset = H5Dcreate(file, "FloatArray", H5T_NATIVE_FLOAT, dataspace, H5P_DEFAULT);
-H5Sclose(dataspace);
-H5Dclose(dataset);
-
-dims[0] = 4;
-dims[1] = 6;
-dataspace = H5Screate_simple(RANK, dims, NULL);
-dataset = H5Dcreate(file, "DoubleArray", H5T_NATIVE_DOUBLE, dataspace,
- H5P_DEFAULT);
-H5Sclose(dataspace);
-H5Dclose(dataset);
-
-/*
- * Attach to /FloatData/String dataset.
- */
-
-dataset = H5Dopen(file, "/FloatData/String");
-if (dataset > 0) printf("/FloatData/String dataset is found\n");
-H5Dclose(dataset);
-H5Fclose(file);
-
+ hid_t file, dir;
+ hid_t dataset, dataspace;
+
+ herr_t status;
+ hsize_t dims[2];
+ hsize_t size[1];
+
+ /*
+ * Create a file.
+ */
+ file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+ /*
+ * Create two groups in a file.
+ */
+ dir = H5Gcreate(file, "/IntData", 0);
+ status = H5Gclose(dir);
+
+ dir = H5Gcreate(file,"/FloatData", 0);
+ status = H5Gclose(dir);
+
+ /*
+ * Create dataspace for the character string
+ */
+ size[0] = 80;
+ dataspace = H5Screate_simple(1, size, NULL);
+
+ /*
+ * Create dataset "String" in the root group.
+ */
+ dataset = H5Dcreate(file, "String", H5T_NATIVE_CHAR, dataspace,
+ H5P_DEFAULT);
+ H5Dclose(dataset);
+
+ /*
+ * Create dataset "String" in the /IntData group.
+ */
+ dataset = H5Dcreate(file, "/IntData/String", H5T_NATIVE_CHAR, dataspace,
+ H5P_DEFAULT);
+ H5Dclose(dataset);
+
+ /*
+ * Create dataset "String" in the /FloatData group.
+ */
+ dataset = H5Dcreate(file, "/FloatData/String", H5T_NATIVE_CHAR, dataspace,
+ H5P_DEFAULT);
+ H5Sclose(dataspace);
+ H5Dclose(dataset);
+
+ /*
+ * Create IntArray dataset in the /IntData group by specifying full path.
+ */
+ dims[0] = 2;
+ dims[1] = 3;
+ dataspace = H5Screate_simple(RANK, dims, NULL);
+ dataset = H5Dcreate(file, "/IntData/IntArray", H5T_NATIVE_INT, dataspace,
+ H5P_DEFAULT);
+ H5Sclose(dataspace);
+ H5Dclose(dataset);
+
+ /*
+ * Set current group to /IntData and attach to the dataset String.
+ */
+ status = H5Gset (file, "/IntData");
+ dataset = H5Dopen(file, "String");
+ if (dataset > 0) printf("String dataset in /IntData group is found\n");
+ H5Dclose(dataset);
+
+ /*
+ * Set current group to /FloatData.
+ */
+ status = H5Gset (file, "/FloatData");
+
+ /*
+ * Create two datasets FlatArray and DoubleArray.
+ */
+ dims[0] = 5;
+ dims[1] = 10;
+ dataspace = H5Screate_simple(RANK, dims, NULL);
+ dataset = H5Dcreate(file, "FloatArray", H5T_NATIVE_FLOAT, dataspace,
+ H5P_DEFAULT);
+ H5Sclose(dataspace);
+ H5Dclose(dataset);
+
+ dims[0] = 4;
+ dims[1] = 6;
+ dataspace = H5Screate_simple(RANK, dims, NULL);
+ dataset = H5Dcreate(file, "DoubleArray", H5T_NATIVE_DOUBLE, dataspace,
+ H5P_DEFAULT);
+ H5Sclose(dataspace);
+ H5Dclose(dataset);
+
+ /*
+ * Attach to /FloatData/String dataset.
+ */
+ dataset = H5Dopen(file, "/FloatData/String");
+ if (dataset > 0) printf("/FloatData/String dataset is found\n");
+ H5Dclose(dataset);
+ H5Fclose(file);
+
+ return 0;
}