Misinterpreted Data when copying from within a thread?

Hello All, I’m having an issue with copying the results after reading from an hdf5 dataset (from within a thread).

The purpose of my project is to concatenate 3 files into 1. So I put different binary files into hdf5, and successfully read them (meaning I know the data that comes from the hdf5 binary dataset is correct; verified this a couple different ways).

However, if I try two different ways (basically a refactor of the same code) of copying the data to a buffer, I get very different results. Visually speaking, 1 result looks like a point cloud (#2 below), and the other looks like a straight line (#1 below), that kind of visually reflects offsets in memory space (like it’s copying the data address as opposed to the data values).

Here is example pseudocode of different “implementations”.

(1) Doesn’t Work - recreates 3D line as mentioned above (this is the implementation I’m after because it matches another person’s code)

for (int id=0; id < numPoints; id++) {
unsigned short offset = 0;
for (int i=0, i < numAttributes; i++)
{
if (!interleaved)
memcpy(buffer.at(i), cldbuffer, size)
}
}

(2) Works - gives point cloud
for (int id=0; id < numPoints; id++) {
memcpy(buffer.at(0), cldbuffer, size)
memcpy(buffer.at(1), cldbuffer, size)
}

Any help would be much appreciated. Thank you for your time.

Best Regards,
Kevin E Dean