diff options
author | Neil Fortner <nfortne2@hdfgroup.org> | 2016-11-29 23:45:20 (GMT) |
---|---|---|
committer | Neil Fortner <nfortne2@hdfgroup.org> | 2016-11-29 23:45:20 (GMT) |
commit | b866bbfe3a2f8b0c3e643a99aebf505bebc3418c (patch) | |
tree | 3d2feb0155fd32319f17b97b5cb0e19f859447ca /examples/h5dsm_dset_write.c | |
parent | 2b28dc62469fb21cb0fff1082e5a6a764e2de8b7 (diff) | |
download | hdf5-b866bbfe3a2f8b0c3e643a99aebf505bebc3418c.zip hdf5-b866bbfe3a2f8b0c3e643a99aebf505bebc3418c.tar.gz hdf5-b866bbfe3a2f8b0c3e643a99aebf505bebc3418c.tar.bz2 |
Fix bugs in read/write implementation. Only seems to read/write the
first element. Examples don't build correctly with make.
Diffstat (limited to 'examples/h5dsm_dset_write.c')
-rw-r--r-- | examples/h5dsm_dset_write.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/examples/h5dsm_dset_write.c b/examples/h5dsm_dset_write.c index a49265d..9b45892 100644 --- a/examples/h5dsm_dset_write.c +++ b/examples/h5dsm_dset_write.c @@ -5,6 +5,7 @@ int main(int argc, char *argv[]) { uuid_t pool_uuid; char *pool_grp = "daos_tier0"; hid_t file = -1, dset = -1, trans = -1, fapl = -1; + uint64_t trans_num; int buf[4][6]; int i, j; @@ -35,6 +36,14 @@ int main(int argc, char *argv[]) { if((dset = H5Dopen_ff(file, argv[3], H5P_DEFAULT, trans)) < 0) ERROR; + /* Get next transaction */ + if(H5TRget_trans_num(trans, &trans_num) < 0) + ERROR; + if(H5TRclose(trans) < 0) + ERROR; + if((trans = H5TRcreate(file, trans_num + 1)) < 0) + ERROR; + /* Fill and print buffer */ printf("Writing data. Buffer is:\n"); for(i = 0; i < 4; i++) { @@ -46,7 +55,11 @@ int main(int argc, char *argv[]) { } /* Write data */ - if(H5Dwrite_ff(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) + if(H5Dwrite_ff(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf, trans) < 0) + ERROR; + + /* Commit transaction */ + if(H5TRcommit(trans) < 0) ERROR; /* Close */ @@ -56,8 +69,6 @@ int main(int argc, char *argv[]) { ERROR; if(H5Fclose(file) < 0) ERROR; - if(H5Sclose(space) < 0) - ERROR; if(H5Pclose(fapl) < 0) ERROR; @@ -72,7 +83,6 @@ error: H5Dclose_ff(dset, -1); H5TRclose(trans); H5Fclose(file); - H5Sclose(space); H5Pclose(fapl); } H5E_END_TRY; |