If you are reading a variable length string with H5LTget_attribute_string 
(H5T_VARIABLE) then you don’t need to allocate the string, just pass in a 
pointer and the library will handle the allocations. If you are reading a fixed 
length string then you need to allocate a string that is “large enough”. Due to 
an oversight on our part you can not find the length of the string using the 
high-level routines, you will need to use the low-level routines to find the 
length.

Scot



> On Jun 23, 2015, at 8:12 AM, Mario Pezzoni <[email protected]> wrote:
> 
> Hello,
> 
> I know how to manipulate attribute with the standard HDF5 API and now I am 
> learning the Lite API to reduce the lines of code in my projects. 
> 
> I write the result of H5LTdtype_to_text to an already existing dataset with 
> the function H5LTset_attribute_string, this works as intended. When I try to 
> read the string using H5LTget_attribute_string I can't find a way to know the 
> string length for the buffer allocation. 
> If I use H5LTget_attribute_info(file_id, "/dset", "attr", &str_size, 
> &type_class, &byte_size) the function do not fail but the variable str_size 
> is left untouched.
> 
> What is the correct way to get the string size?
> 
> Thanks,
> Mario
> _______________________________________________
> 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

_______________________________________________
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