H5F_DELETE deletes an HDF5 file filename with a file access property list fapl_id. The fapl_id should be configured with the same VOL connector or VFD that was used to open the file.
This API was introduced for use with the Virtual Object Layer (VOL). With the VOL, HDF5 "files" can map to arbitrary storage schemes such as object stores and relational database tables. The data created by these implementations may be inconvenient for a user to remove without a detailed knowledge of the storage scheme. H5F_DELETE gives VOL connector authors the ability to add connector-specific delete code to their connectors so that users can remove these "files" without detailed knowledge of the storage scheme.
For a VOL connector, H5F_DELETE deletes the file in a way that makes sense for the specified VOL connector.
For the native HDF5 connector, HDF5 files will be deleted via the VFDs, each of which will have to be modified to delete the files it creates.
For all implementations, H5F_DELETE will first check if the file is an HDF5 file via H5F_IS_ACCESSIBLE. This is done to ensure that H5F_DELETE cannot be used as an arbitrary file deletion call.
Returns a non-negative value if successful; otherwise returns a negative value.
/* Get fapl-dependent filename */
h5_fixname(FILE_DELETE_NOT_HDF5, fapl_id, filename, sizeof(filename));
/* Create a non-HDF5 file */
fd = HDopen(filename, O_RDWR | O_CREAT | O_TRUNC, H5_POSIX_CREATE_MODE_RW);
/* Close the file */
ret = HDclose(fd);
VERIFY(ret, 0, "HDclose");
/* Verify that the file is not an HDF5 file */
/* Note that you can get a FAIL result when h5_fixname()
* perturbs the filename as a file with that exact name