I have a text file with one column of numbers. Eventually these numbers need to be added, averaged etc...but for right now I'm just trying to read them in, then print them out. My main problem is reading until EOF. Since I don't know how long the file will be...
Is there a way to fix this? Or a better way? Also, will I be able to do things like find the max value, min value, average etc using this format?
example of the text file:
Here's an example of the code I'm trying to write. This doesn't work properly though.
printf("Please enter the location of the file to be opened: ");
if(datafile == NULL)
puts("Error opening file");
while(data != EOF)