HDF5 Reference Manual  H5   H5A   H5D   H5E   H5F   H5G   H5P   H5S   H5T   H5Z   Tools  

H5F: File Interface

File API Functions

These functions are designed to provide file-level access to HDF5 files. Further manipulation of objects inside a file is performed through one of APIs documented below.
             

Name: H5Fopen
Signature:
hid_t H5Fopen(const char *name, unsigned flags, hid_t access_id )
Purpose:
Opens an existing file.
Description:
H5Fopen opens an existing file and is the primary function for accessing existing HDF5 files.

The parameter access_id is a file access property list identifier or H5P_DEFAULT for the default I/O access parameters.

The flags argument determines whether writing to an existing file will be allowed or not. The file is opened with read and write permission if flags is set to H5F_ACC_RDWR. All flags may be combined with the bit-wise OR operator (`|') to change the behavior of the file open call. The more complex behaviors of a file's access are controlled through the file-access property list.

Files which are opened more than once return a unique identifier for each H5Fopen() call and can be accessed through all file identifiers.

The return value is a file identifier for the open file and it should be closed by calling H5Fclose() when it is no longer needed.

Parameters:
const char *name
Name of the file to access.
unsigned flags
File access flags. See the H5Fcreate parameters list for a list of possible values.
hid_t access_id
Identifier for the file access properties list.
Returns:
Returns a file identifier if successful; otherwise FAIL (-1).

Name: H5Fcreate
Signature:
hid_t H5Fcreate(const char *name, unsigned flags, hid_t create_id, hid_t access_id )
Purpose:
Creates HDF5 files.
Description:
H5Fcreate is the primary function for creating HDF5 files .

The flags parameter determines whether an existing file will be overwritten. All newly created files are opened for both reading and writing. All flags may be combined with the bit-wise OR operator (`|') to change the behavior of the H5Fcreate call.

The more complex behaviors of file creation and access are controlled through the file-creation and file-access property lists. The value of H5P_DEFAULT for a property list value indicates that the library should use the default values for the appropriate property list. Also see H5Fpublic.h for the list of supported flags.

Parameters:
const char *name
Name of the file to access.
uintn flags
File access flags. Possible values include:
    H5F_ACC_RDWR
    Allow read and write access to file.
    H5F_ACC_RDONLY
    Allow read-only access to file.
    H5F_ACC_TRUNC
    Truncate file, if it already exists, erasing all data previously stored in the file.
    H5F_ACC_EXCL
    Fail if file already exists.
    H5F_ACC_DEBUG
    Print debug information.
    H5P_DEFAULT
    Apply default file access and creation properties.
hid_t create_id
File creation property list identifier, used when modifying default file meta-data.
hid_t access_id
File access property list identifier. If parallel file access is desired, this is a collective call according to the communicator stored in the access_id. Use 0 for default access properties.
Returns:
Returns a file identifier if successful; otherwise FAIL (-1).

Name: H5Fflush
Signature:
herr_t H5Fis_hdf5(hid_t object_id )
Purpose:
Flushes all buffers associated with a file to disk.
Description:
H5Fflush causes all buffers associated with a file to be immediately flushed to disk without removing the data from the cache.

object_id can be any object associated with the file, including the file itself, a dataset, a group, an attribute, or a named data type.

Parameters:
const char *object_id
Identifier of object used to identify the file.
Returns:
Returns SUCCEED (0) if successful; otherwise returns FAIL (-1).

Name: H5Fis_hdf5
Signature:
hbool_t H5Fis_hdf5(const char *name )
Purpose:
Determines whether a file is in the HDF5 format.
Description:
H5Fis_hdf5 determines whether a file is in the HDF5 format.
Parameters:
const char *name
File name to check format.
Returns:
Returns TRUE or FALSE if successful. Otherwise returns FAIL (-1).

Name: H5Fget_create_plist
Signature:
hid_t H5Fget_create_plist(hid_t file_id )
Purpose:
Returns a file creation property list identifier.
Description:
H5Fget_create_plist returns a file creation property list identifier identifying the creation properties used to create this file. This function is useful for duplicating properties when creating another file.

See "File Creation Properties" in H5P: Property List Interface in this reference manual and "File Creation Properties" in Files in the HDF5 User's Guide for additional information and related functions.

Parameters:
hid_t file_id
Identifier of the file to get creation property list of
Returns:
Returns a file creation property list identifier if successful; otherwise FAIL (-1).

Name: H5Fget_access_plist
Signature:
hid_t H5Fget_access_plist(hid_t file_id)
Purpose:
Returns a file access property list identifier.
Description:
H5Fget_access_plist returns the file access property list identifier of the specified file.

See "File Access Properties" in H5P: Property List Interface in this reference manual and "File Access Property Lists" in Files in the HDF5 User's Guide for additional information and related functions.

Parameters:
hid_t file_id
Identifier of file to get access property list of
Returns:
Returns a file access property list identifier if successful; otherwise FAIL (-1).

Name: H5Fclose
Signature:
herr_t H5Fclose(hid_t file_id )
Purpose:
Terminates access to an HDF5 file.
Description:
H5Fclose terminates access to an HDF5 file. If this is the last file identifier open for a file and if access identifiers are still in use, this function will fail.
Parameters:
hid_t file_id
Identifier of a file to terminate access to.
Returns:
Returns SUCCEED (0) if successful; otherwise FAIL (-1).

HDF5 Reference Manual  H5   H5A   H5D   H5E   H5F   H5G   H5P   H5S   H5T   H5Z   Tools  

HDF Help Desk
Last modified: 14 August 1998