On Wed, Oct 19, 2011 at 12:00 PM, <[email protected]> wrote:

>
> Quoting Corey Bettenhausen <[email protected]**>:
>
>  Howdy,
>> When fetching a string attribute using h5ltget_attribute_string_f(), the
>> string returned seems to be a C string i.e null terminated, even when using
>> the Fortran interface.  Thus, one could set an attribute of length 10 and
>> immediately read it and get an 11-character string (to accommodate the null
>> character).  Do ya'll consider this a bug?  Any chance at nipping off that
>> null character before returning?
>>
>
> Yes, the NULL termination should be removed before returning the string
> (the Fortran string will be blank padded if needed). *I think* all the other
> HL fortran APIs which return a string remove the null termination (the
> Fortran HL DS APIs definitely do).
>
> Thanks for pointing this out.


What is the current and the correct behaviour of
h5ltget_attribute_info_f regarding
the type_size dummy argument when the attribute is a character string?

The Fortran binding should probably decrement type_size by the appropriate
amount to account for the missing null character.  Then users can query
their system the length in bytes of the native sharacter type (of length 1)
and then divide the # of bytes returned in type_size by the number of bytes
in a length 1 native string. (i.e. to use with allocatable scalar character
variables.) Does this sound reasonable/true?


Izaak Beekman
===================================
(301)244-9367
Princeton University Doctoral Candidate
Mechanical and Aerospace Engineering
[email protected]

UMD-CP Visiting Graduate Student
Aerospace Engineering
[email protected]
[email protected]
_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

Reply via email to