I have a text file containing three columns of numbers; one column each for the x,y,z
coordinates of a bunch of points. All numbers are between 0
and 1
.
I have created the following structure:
typedef struct
{
double xcd, ycd, zcd;
} point;
I want to create a size-N array of structures of type point
. Then I want to scan the text file line by line and for the n
th particle, I want to put in the three numbers on the n
th line into the respective xcd
, ycd
and zcd
positions.
Tell me if there is some efficeint way of going about this.