Reading the "last line" of a file implies that you are dealing with an humanly readable ASCII text file and there are special characters (/n or /r or a combination of the two) that signify line breaks.
You can only start reading from a certain byte offset using file I/O. Unless all your lines are equal lenght, It is impossible to find the start of the last line without reading
every character leading up to it in one way or another.
So in the most general case, you would need to read the entire file and find the last linefeed.
HOWEVER: Typically, lines are not infinitely long, so if you have an upper estimate of line lenght, you can read a slightly longer tail from the end of the file and find the last linefeed there. You can probably modify the VI I posted
here for your purpose, just use an appropriate length.
🙂Message Edited by altenbach on 06-08-2005 10:42 AM