I want to read cartesian coordinates of a large set of points from of a .txt file into a matrix or some such data structure using a C program.
The file has contents of the type
023 435 1.0
23.5 12.5 0.2
: : : : : :
: : : : : :
and so on...
There are about 4000 such co-ordinates in the file. First column indicates the x-coordinate, second column y and the third column z coordinates. Each row represents a point. I ultimately want to do some computations based on the co-ordinates. I just have a beginners' level idea of File Handling in C.
Any ideas?? Kindly reply asap!
First you might want to use a structure to store each point
Then read the file into an array of points
I'd say fscanf ? (an example is given)
Using sscanf and GNU getline.