summaryrefslogtreecommitdiffstats
path: root/examples/h5_reference.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/h5_reference.c')
-rw-r--r--examples/h5_reference.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/examples/h5_reference.c b/examples/h5_reference.c
index 3bd1ab3..31aa2cf 100644
--- a/examples/h5_reference.c
+++ b/examples/h5_reference.c
@@ -61,7 +61,7 @@ main(void) {
dim_b[0] = 2;
dim_b[1] = 6;
sid_b = H5Screate_simple(2, dim_b, NULL);
- did_b = H5Dcreate(fid, "B", H5T_NATIVE_FLOAT, sid_b, H5P_DEFAULT);
+ did_b = H5Dcreate2(fid, "B", H5T_NATIVE_FLOAT, sid_b, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/*
* Create dataset "R" to store references to the objects "A" and "B".
@@ -69,13 +69,13 @@ main(void) {
dim_r[0] = 2;
sid_r = H5Screate_simple(1, dim_r, NULL);
tid_r = H5Tcopy(H5T_STD_REF_OBJ);
- did_r = H5Dcreate(fid, "R", tid_r, sid_r, H5P_DEFAULT );
+ did_r = H5Dcreate2(fid, "R", tid_r, sid_r, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
/*
* Allocate write and read buffers.
*/
- wbuf = (hobj_ref_t *)malloc(sizeof(hobj_ref_t)*2);
- rbuf = (hobj_ref_t *)malloc(sizeof(hobj_ref_t)*2);
+ wbuf = (hobj_ref_t *)malloc(sizeof(hobj_ref_t) * 2);
+ rbuf = (hobj_ref_t *)malloc(sizeof(hobj_ref_t) * 2);
/*
* Create references to the group "A" and dataset "B"
@@ -87,8 +87,7 @@ main(void) {
/*
* Write dataset R using default transfer properties.
*/
- status = H5Dwrite(did_r, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL,
- H5P_DEFAULT, wbuf);
+ status = H5Dwrite(did_r, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
/*
* Close all objects.
@@ -113,18 +112,17 @@ main(void) {
* Open and read dataset "R".
*/
did_r = H5Dopen2(fid, "R", H5P_DEFAULT);
- status = H5Dread(did_r, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL,
- H5P_DEFAULT, rbuf);
+ status = H5Dread(did_r, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf);
/*
* Find the type of referenced objects.
*/
status = H5Rget_obj_type2(did_r, H5R_OBJECT, &rbuf[0], &obj_type);
- if ( obj_type == H5O_TYPE_GROUP )
+ if(obj_type == H5O_TYPE_GROUP)
printf("First dereferenced object is a group. \n");
status = H5Rget_obj_type2(did_r, H5R_OBJECT, &rbuf[1], &obj_type);
- if ( obj_type == H5O_TYPE_DATASET )
+ if(obj_type == H5O_TYPE_DATASET)
printf("Second dereferenced object is a dataset. \n");
/*
@@ -145,9 +143,7 @@ main(void) {
H5Fclose(fid);
free(rbuf);
free(wbuf);
- return 0;
+ return 0;
}
-
-