How do I tell in a better way how many records there are in a binary file before I open up the file and read the records into an array for example?
MyFile = fopen("DATA.dat", "rb");
i = 0;
while (feof(MyFile) == 0) {
fread(&tempReadingRecord,sizeof(tempReadingRecord), 1, file);
if (feof(MyFile) == 0 {
i++;
}
}
fclose(MyFile);
}
printf("%d", i); /* does work to find out how many records but optimal? */