Dear all,

I am having problems when doing serial HDF5 to read a 2D array of characters.

The writing of the array in hdf5_file works fine using basic HDF5 functions :
(...)
dimsfx[0] = FILE_LEN ;
dimsfx[1] = LINE_LEN ;
sprintf (buf_nameX,"%s,FileName);
dataset = 
H5LTmake_dataset(hdf5_file,buf_nameX,2,dimsfx,H5T_NATIVE_CHAR,buf_lig);
(...)

However I am having problems when reading this 2D-array from hdf5_file::
(...)
char **data;
data = (char**)malloc((FILE_LEN)*sizeof(char*));
         for (int i = 0; i < FILE_LEN; i++) {
               data[i] = (char*)malloc(LINE_LEN*sizeof(char));
        }

if(status = H5LTread_dataset_char(hdf5_file,DATASETNAME,*data) == NULL) {
                   for (i = 0; i < FILE_LEN; i++) {
                                      printf("%s\n",data[i]);
                    }
}
(...)

Looks like the dataset stored in the memory/buffer does not have the same
structure than the dataset stored in the hdf5_file.

Could you please shed light on that point ?

Thanks,

Barbara

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

Reply via email to