Hello Florian,

The flag H5F_ACC_CREAT is not supported in the main library and is removed from 
the C++ API in this coming release.  The documentation will show the correct 
flags also, which are


H5F_ACC_EXCL|H5F_ACC_TRUNC for creating new files

and

H5F_ACC_RDONLY?|H5F_ACC_RDWR for opening existing files


Thanks,

Binh-Minh
________________________________
From: Hdf-forum <[email protected]> on behalf of Florian 
Hoffmann <[email protected]>
Sent: Wednesday, October 01, 2014 4:25 AM
To: [email protected]
Subject: [Hdf-forum] HDF5 1.8.9: H5F_ACC_CREAT

Dear all,

in the HDF5 version I am currently using (1.8.9)  the flag

H5F_ACC_CREAT

is not working. An exception is thrown when I try to create a file like this:

 H5::H5File H5file_ptr = new H5File("./test.h5", H5F_ACC_CREAT);

->

Exception at 0x761bc42d, code: 0xe06d7363: C++ exception, flags=0x1 (execution 
cannot be continued) (first chance) at 
c:\...\hdf5-1.8.9.tar\hdf5-1.8.9\hdf5-1.8.9\c++\src\h5file.cpp:121

refering to the following source code (h5file.cpp):

void H5File::p_get_file(const char* name, unsigned int flags, const 
FileCreatPropList& create_plist, const FileAccPropList& access_plist)
{
    // These bits only set for creation, so if any of them are set,
    // create the file.
    if( flags & (H5F_ACC_CREAT|H5F_ACC_EXCL|H5F_ACC_TRUNC|H5F_ACC_DEBUG))
    {
    hid_t create_plist_id = create_plist.getId();
    hid_t access_plist_id = access_plist.getId();
    id = H5Fcreate( name, flags, create_plist_id, access_plist_id );
    if( id < 0 )  // throw an exception when open/create fail
    {
        throw FileIException("H5File constructor", "H5Fcreate failed");
    }
    }
    // Open the file if none of the bits above are set.
    else
    {
    hid_t access_plist_id = access_plist.getId();
    id = H5Fopen( name, flags, access_plist_id );
    if( id < 0 )  // throw an exception when open/create fail
    {
        throw FileIException("H5File constructor", "H5Fopen failed");
    }
    }
}

A web search did not result in any information on if it has been solved or not 
in later releases.
Does anyone have some information on this ?

Furthermore, is my assumption correct, that this flag means:

Create/Open file in Read/Write mode and keep file content if file already exists

?


Thank you

Best regards,

Florian


--
Mit freundlichen Grüßen
--
Dr.-Ing. Florian Hoffmann
inuTech GmbH            Phone    : +49-(0)911-323843-22
Fuerther Strasse 212    Fax      : +49-(0)911-323843-43
90429 Nuernberg         E-Mai l  : 
[email protected]<mailto:[email protected]>
Germany                 Internet : http://www.inutech.de

inuTech GmbH
Sitz / Registered Office: Nuernberg
Handelsregister / Companies' Register: AG Nürnberg HRB Nr. 19026
Geschäftsführer / Managing Director: Frank Vogel

*****************************************************************
DIFFPACK - THE NEW GENERATION OF SIMULATION-SOFTWARE!

Go to http://www.diffpack.com to read the details
*****************************************************************

_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://mail.lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5

Reply via email to