Quote Originally Posted by fatjuicymole View Post
Assuming a line length will never exceed 132 characters, you could seek to the end of the file, then seek backwards 2,640 bytes (132*20), and then read forwards to the end. Count the number of lines in your buffer, and if it's >= 20 then show the last 20, else read another 2,640 bytes and try again. That way you don't have to read the entire file.
This method requires that you know how the file is beying structured, and wont be usfull if you don't know that.
If you have that information (the lenght of a line) then you can target the correct place to start reading from by subtracting the the size of 20 lines from the file's end.