AnsweredAssumed Answered

using cl::vector push_back

Question asked by shunyo on May 14, 2013
Latest reply on May 17, 2013 by shunyo

Hi everyone, stuck with this very simple problem. I have a vector of points declared as: cl::vector<cl_float3> points. I also have a buffer declared as

cl_float3 buff;

Now I am trying to read in data from a file containing data point coordinates as x, y, z. So, to accomplish this, I use:

while(!feof(FID)){

                    fscanf(FID,"%lf %lf %lf",&buff.s[0],&buff.s[1],&buff.s[2]);

                    points.push_back(buff);

          }

where FID is the file I have been reading from. The problem is while reading, points takes in data for 10 iterations and then doesnt furthur. The loop goes on operating, but I see nothing in the vector. What am I doing wrong? I used a struct of 3 floats which works perfectly, so I am at a loss figuring out where the problem lies.

Outcomes