Hello All,

I'm trying to write some attributes to a dataset and I'd like to use a compound data type to hold the information. I'm using C# and the .NET wrapper. I can read/write just regular string and variable length string datasets and/or attributes with the wrapper, but I can't figure out a good way to write with a compound datatype with a variable length string.

I've tried the following:

1) Create a struct with the SequentialLayout attribute. Then, I created a field for each member of the datatype. For the variable length types, I use the IntPtr. In the constructor for the struct, I generate the pointer to the string value.

2) I create a HDF5 compound datatype. I insert fields and for the string types, I use a type derived from C_S1 and set it to variable length. I use an offset of 4 for the length.

3) Then I created a dataset of the new datatype.

4) Next, I create a C# array of the struct values.

5) Finally, I tried writing the array of structs to the dataset.

However, in that last statement I am getting an exception. Is there a transformation of the struct that I need to do before writing the array? I can post the full code that I've tried if that is helpful in diagnosing.

Thanks,
Jesse

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

Reply via email to