NI Home > Community > NI Discussion Forums

LabVIEW

Showing results for 
Search instead for 
Do you mean 
Reply
Member
Michel Verhelpen
Posts: 1
0 Kudos

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
Member
Johannes Niess
Posts: 78
0 Kudos

Re: How to read the x last lines of a text file

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