HDF5 C++ API - DataSet.write Vs Attribute.write

Hello HDF members,

Maybe, am wrong . but my results with HDF5 C++ API of comparing
DataSet.write/Attribute.write shows me that

<a.> Create a DataSet, Open the same dataset again, and write to the
dataset - Open the file and u see that Dataset values are 10,20 - which
is what you expect !! - GOOD results.
<b.> Create an Attribute, Open the same attribute again, and write to the
attribute - Open the file and u see that Attribute values are 0, 0 , when
you ideally expect 10,20. - WRONG results.

sample code

···

-------------------
        int d1[2]={10,20};
        DataSet dset_temp = grp_1.openDataSet("dset_1"); //grp_1 is a
group object, Dataset rank=1, dimension=2
               dset_temp.write((void*) d1, PredType::NATIVE_INT); //works
good - writes to hdf file

        //DataSet dset_temp = f1
                Attribute attr_temp = dset_1.openAttribute("attr_1");
//dset_1 is a dataset object, Attribute rank=1, dimension=2
        attr_temp.write(PredType::NATIVE_INT,(void*) d1); //works bad -
does not write to hdf file

Thanks
Anish Anto

Hi Anish,

Hello HDF members,

Maybe, am wrong . but my results with HDF5 C++ API of comparing DataSet.write/Attribute.write shows me that

<a.> Create a DataSet, Open the same dataset again, and write to the dataset - Open the file and u see that Dataset values are 10,20 - which is what you expect !! - GOOD results.
<b.> Create an Attribute, Open the same attribute again, and write to the attribute - Open the file and u see that Attribute values are 0, 0 , when you ideally expect 10,20. - WRONG results.

  Many pieces of HDF5 data, including attributes, are cached in memory. Are you checking the attribute from another process while the first process still has the file open?

  Quincey

···

On Feb 28, 2008, at 2:32 PM, Anish Anto wrote:

sample code
-------------------
        int d1[2]={10,20};
        DataSet dset_temp = grp_1.openDataSet("dset_1"); //grp_1 is a group object, Dataset rank=1, dimension=2
               dset_temp.write((void*) d1, PredType::NATIVE_INT); //works good - writes to hdf file

        //DataSet dset_temp = f1
                Attribute attr_temp = dset_1.openAttribute("attr_1"); //dset_1 is a dataset object, Attribute rank=1, dimension=2
        attr_temp.write(PredType::NATIVE_INT,(void*) d1); //works bad - does not write to hdf file

Thanks
Anish Anto

----------------------------------------------------------------------
This mailing list is for HDF software users discussion.
To subscribe to this list, send a message to hdf-forum-subscribe@hdfgroup.org.
To unsubscribe, send a message to hdf-forum-unsubscribe@hdfgroup.org.