|
H5CPP
v1.14.0
Modern C++ templates for HDF5 serial and parallel I/O
|
|
Create a new HDF5 file at path. RAII-managed h5::fd_t returned; no explicit close.
Creates a new HDF5 container at path. The flags argument controls overwrite behaviour; fcpl controls the on-disk meta-data layout; fapl controls the file driver and parallel I/O settings.
Parameters
| Name | Type | Description |
|---|---|---|
path | const std::string& | OS file system path to the new HDF5 container. |
flags | unsigned | One of H5F_ACC_TRUNC (overwrite if exists), H5F_ACC_EXCL (fail if exists), H5F_ACC_DEBUG (verbose CAPI diagnostics). |
fcpl | const h5::fcpl_t& | File-creation property list. Defaults to h5::default_fcpl. |
fapl | const h5::fapl_t& | File-access property list. Defaults to h5::default_fapl. For parallel I/O, pass an MPI-aware FAPL. |
Returns — h5::fd_t RAII handle; closes via H5Fclose on scope exit.
Throws
| Exception | When |
|---|---|
h5::error::io::file::create | H5Fcreate failed (path unwritable, EXCL conflict, …) |
h5::error::property_list::misc | Invalid fcpl or fapl was supplied. |
Example
DO capture the result into
h5::fd_t(orauto), then pass throughstatic_cast<::hid_t>(fd)when interoping with raw CAPI. DON'T assign directly to ahid_tvariable — the temporaryh5::fd_tcloses the handle as it goes out of scope, invalidating the raw id: