What’s the storage layout of the attribute?
(i.e., is it H5S_SIMPLE or H5S_SCALAR?)

G.

From: Hdf-forum [mailto:[email protected]] On Behalf Of Matt 
Wood
Sent: Thursday, March 30, 2017 9:42 AM
To: [email protected]
Subject: [Hdf-forum] Reading VLEN string attribute values.

Hi,

I am using HDF.PInvoke 1.10.0.4 but I am struggling to read the string value of 
an attribute when it is variable length.

Ultimately I believe I need to call:

GCHandle hnd = GCHandle.Alloc(data, GCHandleType.Pinned);
int err = H5A.read(aid, typeId, hnd.AddrOfPinnedObject());
hnd.Free();

Where data is a suitable object.

I am confident that the attribute id (aid) is correct because it works for all 
the other attributes types.

I am not so confident on the typeId, I have tried:

   H5T.get_type(aid);
* H5T.get_native_type(tid);
   H5T.create(H5T.class_t.VLEN, H5T.VARIABLE);
   H5T.create(H5T.class_t.STRING, H5T.VARIABLE);

Likewise for the data and I have tried:

*  data = new byte[256];
    data = new IntPtr[1]; => data[0] = GCHandle.Alloc(byte[256], 
GCHandleType.Pinned).AddrOfPinnedObject()

The only time some non-zero values were returned was case (*) but then I 
couldn't relate the values to the expected text.

Thanks,

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

Reply via email to