R/H5F.R
H5Fget_intent.RdDetermine the read only or read/write status of an open file handle.
H5Fget_intent(h5file)An object of class H5IdComponent representing a H5
file identifier. Typically produced by H5Fopen() or H5Fcreate().
Returns a character vector of length 1. This will either be H5F_ACC_RDWR (read / write)
or H5F_ACC_READONLY (read only).
The native H5Fget_intent() function can in theory also return the values H5F_ACC_SWMR_WRITE
and H5F_ACC_SWMR_READ. However these require the underlying HDF5 library to be complied with
support for single-writer/multiple-reader (SWMR), which Rhdf5lib currently is not. Hence only the two
values detailed in the values section should be possible.
## use an example file and show its location
h5file <- system.file("testfiles", "h5ex_t_array.h5", package = "rhdf5")
## open the file as read only and check this
fid <- H5Fopen(h5file, flags = "H5F_ACC_RDONLY")
H5Fget_intent(fid)
#> [1] "H5F_ACC_RDONLY"
H5Fclose(fid)
## open file as read write and confirm
fid <- H5Fopen(h5file, flags = "H5F_ACC_RDWR")
H5Fget_intent(fid)
#> [1] "H5F_ACC_RDWR"
H5Fclose(fid)