Last line of a data file not wanted to be read in and the while statement
Ok, I am utilizing an while statement to read a data file. Caveat: the last line of the data file is useless and contains just a eccentric time stamp and the file name to signify its the last record.
My initial method was to utilize this prior to the while loop:
Code:
flag = fseek(ifp, fpi, SEEK_END);
elfi = ftell(ifp);
Then read in the last line as a string and use strcpy. Then can use this expression in the while loop so when it gets to this line it can compare strings and stop - thus not reading it in. Problem though is when setting the file position to the end, the position is offset bytes from the place and I don't think its quite what I want, thus it still reading the last line and breaking my statement to read in the data.
Any efficient ideas to this problem?