reading values from a file
There is a file which has data in the way shown below.
Each row is sort of a record.
For each record i will be needing values in the first column(+/- 1) and the other floating
point values in the row
eg:.23232
(not the colon':' and the serial numbers)
(The number of fields is same in each row)
The source is in c.The way i had in mind was using a structure
with int char double fields and then using fscanf to read them as it is
and then extracting the requisite values.
The problem is since the data in all rows may not be spaced uniformly in
all rows(not a possibility but since data is huge cannot be predicted)
it is becoming difficult to move the file pointer in same way in all rows.
Can someone suggest a simple and computationally inexpensive way of
storing the values?
FILE
Code:
1 1:.2345 2:.3454 3:.238909 ........ 10,000:.4329407
-1 1:.1201890 2:.121211 ............. 10,000:.3123123
-1 1:.12323 2:.312312....... 10,000:.312081290
.
.
.
.
.
-1 1:.3213123 2:.321312 10,000:.31231232