HDF5 1.8.4 & String attribute with fortran

Hello,

I use HDF5 1.8.4 compiled with ifort 11.1 on a linux Ubuntu 9.04 box.

If I write a string attribute in fortran, then when I read it the string
is terminated with an invisible null character.
So it is very difficult to deal with it (concatanation is very
hasardeous for instance).

Is it a bug or the right behaviour ?

Thanks a lot,

Cyril.

Note :
If I write a string attribute in python/pytables, then when I read it
the string is NOT terminated with an invisible null character.

Cyril,

Are you using HL Fortran APIs? if so, it is a deficiency of the current API. The API is a wrapper around C HL API that uses H5T_S_C1 datatype; fortran wrapper modified user's buffer by adding \0 character (yes, very bad....) We have bug filed and hopefully will resolve it for the 1.8.5 release.

If you are using regular HDF5 Fortran APIs, please send me a program that demonstrates the problem (i.e., your fortran data is modified with trailing \0).

Thank you!

Elena

···

On Jan 13, 2010, at 8:45 AM, Giraudon Cyril wrote:

Hello,

I use HDF5 1.8.4 compiled with ifort 11.1 on a linux Ubuntu 9.04 box.

If I write a string attribute in fortran, then when I read it the string
is terminated with an invisible null character.
So it is very difficult to deal with it (concatanation is very
hasardeous for instance).

Is it a bug or the right behaviour ?

Thanks a lot,

Cyril.

Note :
If I write a string attribute in python/pytables, then when I read it
the string is NOT terminated with an invisible null character.

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

Elena,

Effectively, I use HL Fortran API to read HDF5 files (not necessarily to
write files).
For the moment I add a

buf(scan(char(0):)) = ""

to clean my strings.

Regards,

Cyril.

Le 16/01/2010 02:43, Elena Pourmal a �crit :

···

Cyril,

Are you using HL Fortran APIs? if so, it is a deficiency of the current API. The API is a wrapper around C HL API that uses H5T_S_C1 datatype; fortran wrapper modified user's buffer by adding \0 character (yes, very bad....) We have bug filed and hopefully will resolve it for the 1.8.5 release.

If you are using regular HDF5 Fortran APIs, please send me a program that demonstrates the problem (i.e., your fortran data is modified with trailing \0).

Thank you!

Elena
On Jan 13, 2010, at 8:45 AM, Giraudon Cyril wrote:

Hello,

I use HDF5 1.8.4 compiled with ifort 11.1 on a linux Ubuntu 9.04 box.

If I write a string attribute in fortran, then when I read it the string
is terminated with an invisible null character.
So it is very difficult to deal with it (concatanation is very
hasardeous for instance).

Is it a bug or the right behaviour ?

Thanks a lot,

Cyril.

Note :
If I write a string attribute in python/pytables, then when I read it
the string is NOT terminated with an invisible null character.

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