How to read the x last lines of a text file 
Author Message
 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



Fri, 13 Dec 2002 03:00:00 GMT  
 How to read the x last lines of a text file

Quote:

> 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



Fri, 13 Dec 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. how to read text files line by line?

2. Read a text file line by line

3. How do I read lines of Text from Text File and add them to Array

4. Deleting the last lines in a text file with tcl

5. read the last line in file

6. How to read the last line of http:// file

7. File: How to read the last line?

8. read only the last x bytes from a text file

9. reading lines of text in files.

10. How to read lines from a text file?

11. Detecting blank lines in text file read

12. Reading more than one line of input from a text file

 

 
Powered by phpBB® Forum Software