Hi David,

It wasn't the intention for file's hid_t to be used that way, but here is a 
possible workaround.

/* Assuming file_id is the hid_t you have */
H5File file2;  /* create a default H5File object */
file2.setId(file_id);  /* assign the Id to this object using the existing hid_t 
*/

Please be mindful that this id might be closed when file2 is going out of 
scope.  If premature closing of the id happens, one way to work around that is 
to reset file2's id to 0, before it's going out of scope.  I hope this works 
for you.

Thank you,
Binh-Minh
________________________________
From: Hdf-forum <[email protected]> on behalf of David 
Froger <[email protected]>
Sent: Thursday, September 12, 2013 9:41 AM
To: [email protected]
Subject: [Hdf-forum] H5LTopen_file_image for C++ API

Hi,

I'm using a C++ library that read in a HDF5 file with the C++ HDF5 API,
using a H5File instance.

I would like to use this library to read a file image (file in memory)
instead of a file in the disk.

In C, this can be done with the 'H5LTopen_file_image' function, from HDF5
Lite, which return a hid_t for the opened file, that can be pass to other
functions (H5Dopen, ...). How could I build a H5File from this hid_t, so I
don't have to rewrite the library from the C++ HDF5 to the C HDF5 API?

Or is there another solution to read a file image with the C++ HDF5 API?

Thanks in advance,
David
~
_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://mail.lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org

Reply via email to