Page tree

The license could not be verified: License Certificate has expired!

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Content Layer
id1195548671
Content Column
width50.00001%
id1195578110
classrm_pagetree_col mobile-hide
Content Block
id1195578111
 
Content Column
width50.00001%
id1195548673
classhdf-rm-main-column
Content Block
id1195548672

Include Content
render-without-blockstrue
page.rm-navbar
HTML Wrap
classhdf-print-only

Page Title

HTML Wrap
classhdf-rm-summary-block

Hdf rm anchor
AnchorNamesummary

Excerpt

Creates an HDF5 file

HTML Wrap
classhdf-rm-content-block

Hdf rm anchor
AnchorNameprocedure

Procedure:
HTML Wrap
classhdf-rm-section
HTML Wrap
classhdf_procedure

H5F_CREATE (name, flags, fcpl_id, fapl_id)

Hdf rm anchor
AnchorNamesignature

Signature:
HTML Wrap
classhdf-rm-section
HTML Wrap
classhdf-togglebox hdf-c

HTML Add Class
hdf-togglebutton-visible
hdf-togglebutton-visible
selector.hdf-togglebutton.hdf-c

HTML
<pre><code class="language-c">hid_t H5Fcreate( const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id )</code></pre>
HTML Wrap
classhdf-togglebox hdf-fortran hdf-togglebox-hidden

HTML Add Class
hdf-togglebutton-visible
hdf-togglebutton-visible
selector.hdf-togglebutton.hdf-fortran

HTML
<pre><code class="language-fortran">SUBROUTINE h5fcreate_f(name, access_flags, file_id, hdferr, &  
                       creation_prp, access_prp)
  IMPLICIT NONE 
  CHARACTER(LEN=*), INTENT(IN) :: name   ! Name of the file
  INTEGER, INTENT(IN) :: access_flag     ! File access flags 
                                         ! Valid values are:
                                         !     H5F_ACC_TRUNC_F  
                                         !     H5F_ACC_EXCL_F    
                                         !     H5F_ACC_DEBUG_F   
  INTEGER(HID_T), INTENT(OUT) :: file_id ! File identifier 
  INTEGER, INTENT(OUT) :: hdferr         ! Error code 
                                         ! 0 on success and -1 on failure
  INTEGER(HID_T), OPTIONAL, INTENT(IN) :: creation_prp 
                                         ! File creation propertly 
                                         ! list identifier, if not 
                                         ! specified its value is
                                         ! H5P_DEFAULT_F  
  INTEGER(HID_T), OPTIONAL, INTENT(IN) :: access_prp  
                                         ! File access property list 
                                         ! identifier, if not 
                                         ! specified its value is
                                         ! H5P_DEFAULT_F  
END SUBROUTINE h5fcreate_f</code></pre>

Hdf rm anchor
AnchorNameparameters

Parameters:
HTML Wrap
classhdf-rm-section
const char *name    IN: Name of the file to access
unsigned flags

IN: File access flags. Allowable values are:

H5F_ACC_TRUNCTruncate file, if it already exists, erasing all data previously stored in the file
H5F_ACC_EXCLFail if file already exists
  • H5F_ACC_TRUNC and H5F_ACC_EXCL are mutually exclusive; use exactly one.
  • An additional flag, H5F_ACC_DEBUG, prints debug information. This flag can be combined with one of the above values using the bit-wise OR operator (`|'), but it is used only by HDF5 library developers; it is neither tested nor supported for use in applications.
hid_t fcpl_idIN: File creation property list identifier, used when modifying default file meta-data. Use H5P_DEFAULT to specify default file creation properties.
hid_t fapl_idIN: File access property list identifier. If parallel file access is desired, this is a collective call according to the communicator stored in the fapl_id. Use H5P_DEFAULT for default file access properties.

Hdf rm anchor
AnchorNamedescription

Description:
HTML Wrap
classhdf-rm-section

H5F_CREATE is the primary function for creating HDF5 files; it creates a new HDF5 file with the specified name and property lists.

The name parameter specifies the name of the new file.

The flags parameter specifies whether an existing file is to be overwritten. It should be set to either H5F_ACC_TRUNC to overwrite an existing file or H5F_ACC_EXCL, instructing the function to fail if the file already exists.

New files are always created in read-write mode, so the read-write and read-only flags, H5F_ACC_RDWR and H5F_ACC_RDONLY, respectively, are not relevant in this function. Further note that a specification of H5F_ACC_RDONLY will be ignored; the file will be created in read-write mode, regardless.

More complex behaviors of file creation and access are controlled through the file creation and file access property lists, fcpl_id and fapl_id, respectively. The value of H5P_DEFAULT for any property list value indicates that the library should use the default values for that appropriate property list.

The return value is a file identifier for the newly-created file; this file identifier should be closed by calling H5F_CLOSE when it is no longer needed.

Special case -- File creation in the case of an already-open file: 
If a file being created is already opened, by either a previous H5F_OPEN or H5F_CREATE call, the HDF5 library may or may not detect that the open file and the new file are the same physical file. (See H5F_OPEN regarding the limitations in detecting the re-opening of an already-open file.)

If the library detects that the file is already opened, H5F_CREATE will return a failure, regardless of the use of H5F_ACC_TRUNC.

If the library does not detect that the file is already opened and H5F_ACC_TRUNC is not used, H5F_CREATE will return a failure because the file already exists. Note that this is correct behavior.

But if the library does not detect that the file is already opened and H5F_ACC_TRUNC is used, H5F_CREATE will truncate the existing file and return a valid file identifier. Such a truncation of a currently-opened file will almost certainly result in errors. While unlikely, the HDF5 library may not be able to detect, and thus report, such errors.

Applications should avoid calling H5F_CREATE with an already opened file.

Hdf rm anchor
AnchorNamereturns

Returns:
HTML Wrap
classhdf-rm-section

Returns a file identifier if successful; otherwise returns a negative value. 

Hdf rm anchor
AnchorNameexample

Example:
HTML Wrap
classhdf-rm-section
HTML Wrap
classhdf-togglebox hdf-c

Bitbucket Server file
repoSlughdf5
branchIdrefs/heads/1.10/master
projectKeyHDFFV
filepathexamples/h5_crtdat.c
showLineNumberstrue
lineStart27
progLangplain
lineEnd30
applicationLink5ac7b370-7412-3c8c-ad20-807a68261336

HTML Wrap
classhdf-togglebox hdf-fortran hdf-togglebox-hidden

Bitbucket Server file
repoSlughdf5
branchIdrefs/heads/1.10/master
projectKeyHDFFV
filepathfortran/examples/h5_crtdat.f90
showLineNumberstrue
lineStart45
progLangplain
lineEnd50
applicationLink5ac7b370-7412-3c8c-ad20-807a68261336

See Also:
HTML Wrap
classhdf-rm-section

Using Identifiers

Hdf rm anchor
AnchorNamehistory

History:
HTML Wrap
classhdf-rm-section
Release    Change
1.8.10Removed H5F_ACC_RDWR_F and H5F_ACC_RDONLY_F from comments for access_flag field in Fortran subroutine, and changed “Possible values” to “Valid values”.
1.4.0Fortran API introduced in this release.
1.0.0C function introduced in this release.