I'm trying to readnlines of numbers with in each of the lines 6 numbers. These numbers(each line) are the coordinates of a triangle like:

4 ->number of triangles(lines)

x1 y1 x2 y2 x3 y3

x1 y1 x2 y2 x3 y3

x1 y1 x2 y2 x3 y3

x1 y1 x2 y2 x3 y3

My input file looks like this:

And my readTriangle.c :Code:4 0 0 0 4 3 0 3 3 6 1 0 0 2 3 1 1 0 9 3 4 5 7 1 1

Now my problem is that my program thinks these number are all 0. Of course the area is also 0.Code:#include "triangle.h" #include "point.h" #include <stdio.h> #include <stdlib.h> #include <math.h> int main() { double x1,y1,x2,y2,x3,y3; int i, a; Point p1, p2, p3; FILE *bestand; bestand = fopen("bestand.txt", "r"); if(bestand == NULL) { printf("kan het bestand niet openen!\n"); exit(1); } fscanf(bestand, "%d", &a); // read the first number(number of triangles) for(i = 0; i < a; i++) // repeat this until you're done with all the lines { fscanf(bestand, "%f", &x1); fscanf(bestand, "%f", &y1); fscanf(bestand, "%f", &x2); fscanf(bestand, "%f", &y2); fscanf(bestand, "%f", &x3); fscanf(bestand, "%f", &y3); p1 = makePoint(x1, y1); p2 = makePoint(x2, y2); p3 = makePoint(x3, y3); Triangle t = makeTriangle(p1, p2, p3); //if(isEmpty(t)) //{ //printf("deze punten maken geen driehoek!\n"); //} //else //{ printf("de driehoek: "); showTriangle(t); printf("heeft een oppervlakte van %f \n", area(t)); //} } fclose(bestand); return 0; }

normally(without the reading) my area function calculates different area's each time(very big numbers) . But when I test it seperately It works fine!!!

I'm using makeFile to compile

does anybody know how I can fix it?

Thanks,

Nima