The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....



ReadLastNLinesOfTextFile


Unit:SDL_filesys
Class: none
Declaration: [1] function ReadLastNLinesOfTextFile (const FVar: TextFile; NLines: integer; var Count: integer): TStrArray;
[2] function ReadLastNLinesOfTextFile (const FName: string; NLines: integer; var Count: integer): TStrArray;

The function ReadLastNLinesOfTextFile reads the NLines last lines of a text file specified by FVar or FName. Version [1] requires an open text file, the file pointer is reset by the function. In the case of version [2] the file is opened (and closed) using the filename FName.

The variable parameter Count returns the total number of lines in the file, the last NLines lines are returned as an open array whose size is adjusted to NLines.


Last Update: 2023-Feb-06