summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/h5_ref2reg.c9
-rw-r--r--examples/h5_reference.c9
2 files changed, 15 insertions, 3 deletions
diff --git a/examples/h5_ref2reg.c b/examples/h5_ref2reg.c
index 17ec724..4db7671 100644
--- a/examples/h5_ref2reg.c
+++ b/examples/h5_ref2reg.c
@@ -39,6 +39,7 @@ int main(void)
hid_t spacer_id;
hid_t dsetv_id; /*dataset identifiers*/
hid_t dsetr_id;
+ hid_t dapl_id; /* Dataset access property list */
hsize_t dims[2] = {2,9};
hsize_t dimsr[1] = {2};
int rank = 2;
@@ -67,6 +68,9 @@ int main(void)
space_id = H5Screate_simple(rank, dims, NULL);
spacer_id = H5Screate_simple(rankr, dimsr, NULL);
+ /* Create dataset access property list */
+ dapl_id = H5Pcreate(H5P_DATASET_ACCESS);
+
/*
* Create integer dataset.
*/
@@ -130,7 +134,7 @@ int main(void)
/*
* Dereference the first reference.
*/
- dsetv_id = H5Rdereference(dsetr_id, H5R_DATASET_REGION, &ref_out[0]);
+ dsetv_id = H5Rdereference(dsetr_id, dapl_id, H5R_DATASET_REGION, &ref_out[0]);
/*
* Get name of the dataset the first region reference points to
* using H5Rget_name
@@ -177,7 +181,7 @@ int main(void)
/*
* Dereference the second reference.
*/
- dsetv_id = H5Rdereference(dsetr_id, H5R_DATASET_REGION, &ref_out[1]);
+ dsetv_id = H5Rdereference(dsetr_id, dapl_id, H5R_DATASET_REGION, &ref_out[1]);
space_id = H5Rget_region(dsetv_id, H5R_DATASET_REGION,&ref_out[1]);
/*
@@ -199,6 +203,7 @@ int main(void)
* Close dataspace and the dataset.
*/
status = H5Sclose(space_id);
+ status = H5Pclose(dapl_id);
status = H5Dclose(dsetv_id);
status = H5Dclose(dsetr_id);
status = H5Fclose(file_id);
diff --git a/examples/h5_reference.c b/examples/h5_reference.c
index 31aa2cf..3820345 100644
--- a/examples/h5_reference.c
+++ b/examples/h5_reference.c
@@ -35,6 +35,7 @@ main(void) {
hid_t gid_a; /* and dataspaces identifiers */
hid_t did_b, sid_b, tid_b;
hid_t did_r, tid_r, sid_r;
+ hid_t dapl_id; /* Dataset access property list */
H5O_type_t obj_type;
herr_t status;
@@ -55,6 +56,11 @@ main(void) {
*/
gid_a = H5Gcreate2(fid, "A", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ /*
+ * Create dataset access property list
+ */
+ dapl_id = H5Pcreate(H5P_DATASET_ACCESS);
+
/*
* Create dataset "B" in the file.
*/
@@ -128,7 +134,7 @@ main(void) {
/*
* Get datatype of the dataset "B"
*/
- did_b = H5Rdereference(did_r, H5R_OBJECT, &rbuf[1]);
+ did_b = H5Rdereference(did_r, dapl_id, H5R_OBJECT, &rbuf[1]);
tid_b = H5Dget_type(did_b);
if(H5Tequal(tid_b, H5T_NATIVE_FLOAT))
printf("Datatype of the dataset is H5T_NATIVE_FLOAT.\n");
@@ -137,6 +143,7 @@ main(void) {
/*
* Close all objects and free memory buffers.
*/
+ H5Pclose(dapl_id);
H5Dclose(did_r);
H5Dclose(did_b);
H5Tclose(tid_b);