in reply to Reading a value two lines before the current line

(Depends on the size of the file, and what you are trying to do...Generally speaking)
  1. If the file is not big, and you have to process many lines, read the whole thing into an array, two line back is just another element of the array, no big deal.
  2. If the file is big, read in line by line, but always remember the last 4 lines, instead of only the last line.
  3. If the file is big, and you only care line 10000 and 10003, it would be a big waste to read line by line. seek back can do the trick, but if the records are not fixed-length, you have to deal with new lines and all the calculation, not very ideal.