Hi Daniel,

On May 4, 2011, at 3:13 AM, Sentenac Daniel wrote:

> Hello,
> I am currently doing a very small test to retreive the size of a just created 
> HDF5 file using the function
> H5Fget_filesize and cannot understand why the size returned is actually 
> different from the real one.
> 
> Here is the simple example piece of code:
> 
> hsize_t size;
> hid_t file_id = H5Fcreate("file.hdf5", H5F_ACC_TRUNC, H5P_DEFAULT, 
> H5P_DEFAULT);
> H5Fget_filesize( file_id, &size );
> 
> The real size of the file appears to be 800 bytes, while the size returned 
> fromH5Fget_filesize is 2144 bytes.

        The library allocates a 2KB buffer to sub-allocate metadata from (in 
addition to the ~100 byte superblock for the file), but then truncates the 
file's size down to the actual amount of data used in the file, when the file 
is closed.

> I would like to use the function H5Fget_vfd_handle to get a (char*) buffer 
> copy of the file. Can someone help me to do that correctly ?

        I would recommend against this sort of mucking with the bytes - the 
HDF5 library does a lot of work behind the scenes and you probably won't get a 
coherent picture of the file by just looking at the bytes.

        That said, why do you want to do this?  Possibly the "core" VFD 
(H5Pset_fapl_core) would meet your needs?

        Quincey

_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

Reply via email to