Hi,
it's easier to have just one contiguous buffer of type char* with a
single allocation for doing the I/O. If your strings are all of fixed
length, you can pack all those independent strings into a single char*
buffer . Then do I/O on that one-dimensional buffer of chars, and when
you need them as strings, you extract them from this char* buffer.
On 27.07.2017 20:49, Deepak 8 Kumar wrote:
I am reading hdf5 file which has String dataset values with fixed
length size and the number of dimensions is 1. I am using HDF 1.10.1
Windows10 x64.
I allocate array of pointers to read the data values in the same way
as given in the hdf5 documentation. Here is the code which is reading
the string dataset values.
In this code, the dynamic 2D array of pointers is not initialized as
per the standard way using a loop.
unique_ptr<T*[]> apbuffer = make_unique<T*[]>(size_of_dimensions[0]);
T** buffer = dpbuffer.get();
unique_ptr<T[]> apbuffer1 = make_unique<T[]>(size_of_dimensions[0] *
size);
buffer[0] = dpbuffer1.get();
for (int i = 1; i < size_of_dimensions[0]; i++) {
buffer[i] = buffer[0] + i * size_of_dimensions[1];
}
H5Dread(dataset_id, dataset_type_id, H5S_ALL, H5S_ALL, H5P_DEFAULT,
&buffer[0][0]);
I would like to know, what are other possible ways to allocate the
buffer to read 1 dimension string dataset values?
Can we simply read the 1 dimension dataset values by passing arrays
pointed to the buffer?
Any insight is greatly appreciated.
_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5
--
___________________________________________________________________________
Dr. Werner Benger Visualization Research
Center for Computation & Technology at Louisiana State University (CCT/LSU)
2019 Digital Media Center, Baton Rouge, Louisiana 70803
Tel.: +1 225 578 4809 Fax.: +1 225 578-5362
_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@lists.hdfgroup.org
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5