I'm having to write a program in C because I need to use some numerical libraries.
I need to read a text file which contain x number of lines with each line having two doubles. For testing I had a dummy file which I knew the length of and hard coded into the program. But now I want to give it any file with having to hard code the number of lines into the program and recompile. Below is the sample code I'm using.
My question is how do I figure out the number of lines in a file. and two is my code below good or should I rework it to run better.
double ld ;
int i = 0;
int j = 0;
if (( fp = fopen("./a/data.dat","r"))==NULL)
printf("File not Opened\n");