Modifying access properties after file is created


#1

I am trying to set the alignment property of a file after it has already been created using H5Fcreate.
I tried this, but it fails.

    fapl1 = H5Fget_access_plist(h5info->hdfid);
    threshold = 1024;
    alignment = 1024;
    if (H5Pset_alignment(fapl1, threshold, alignment) < 0) <error>;
    if (H5Pclose(fapl1) < 0) <error>;

I also tried to copy the fapl and use that; it failed also.

    fapl1 = H5Fget_access_plist(h5info->hdfid);
    threshold = 1024;
    alignment = 1024;
    fapl2 = H5Pcopy(fapl1);
    if (H5Pset_alignment(fapl2, threshold, alignment) < 0) <error>;
    if (H5Pclose(fapl1) < 0) <error>;
    if (H5Pclose(fapl2) < 0) <error>

Is this even possible? If so, any ideas on how to do it?


#2

H5Fget_access_plist returns a copy of the access property list of an already open HDF5 file. You have to set the file access properties before creating/opening the file, i.e.,

hid_t fapl = H5Pcreate(H5P_FILE_ACCESS);
H5Pset_alignment(fapl, threshold, alignment);
...
H5Fopen(..., fapl) or  H5Fcreate(..., fapl)

OK?

G.