From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to read the x last lines of a text file

It is certainly easy for you but I don't see how to read the x last
lines of a text file.

Using the ReadFile.vi we can choose the pos mode (top, end of file )
defining the position of the cursor but with the cursor at the end of
the file how to read the last line, the last-1 line, last-2 ... ?
It must exist a method to do that.
Thank you for helping me.
Michel Verhelpen
0 Kudos
Message 1 of 2
(2,820 Views)
Michel Verhelpen writes:

> It is certainly easy for you but I don't see how to read the x last
> lines of a text file.
>
> Using the ReadFile.vi we can choose the pos mode (top, end of file )
> defining the position of the cursor but with the cursor at the end of
> the file how to read the last line, the last-1 line, last-2 ... ?
> It must exist a method to do that.
> Thank you for helping me.
> Michel Verhelpen

Michael,

what about getting the dimensions of the array of lines and using
array subset with a start of last -2 and an end of last?

Johannes Niess
0 Kudos
Message 2 of 2
(2,820 Views)