Read in .dat file unknown number of rows
Ok so i have a couple of .dat files i want to read into my program to then go on and do multiple calculations too..
The .dat files have different number of rows each and are just numbers
They have 2 columns separated by a space.
What i want to do is to read them into C into dynamic allocated arrays the left column going to an array called 'x' and the right column going to an array called 'y'
How can i find out the number of rows so i can then malloc the arrays or is there some sort of loop i can create??
Also i've heard its bad to use EOF??
any help would be much apprecitated