I'll keep this short and to the point.
Each line in a data file I will open up in my C program to read contains the vertices for one face of the object, made by an amount of vertices, made up of it's x y z points.
Ex: (1st) x, y, z, (2nd) x, y, z, (3rd) x, y, z, (4th) x, y, z ... (can have more than four vertices per face)
Ex: 0.139383 -0.239560 0.394645 0.140653 -0.243475 0.393312 0.141220 -0.243473 0.393834 0.139949 -0.239557 0.395167 (has four vertices in this face)
The data file has many lines, aka, many faces in the object.
After opening the file with fopen, how can I put the data into a linked list?
I know I will need a while loop that will sort through the data starting at the beginning and assigning the values into a struct I have called point.
I also have setup a linked list.
typedef struct _point
float x, y, z;
Problem is I have no idea how to tell the program to read the file (other than fopen) and to assign the info into the struct and how to tell it to go onto the next node when hitting the return character at the end of each line. If you could give me a push in the right direction, it would be a big help. Thanks.
int vCount; // pointer to data value to be stored
point *vptr; // pointer to array of structs containing vertices
struct node *next; // pointer to next node