[scilab-Users] Reading the llast line from a file

Mike Page Mike at Page-One.Waitrose.com
Tue Jun 26 15:33:30 CEST 2012


Hi,

You can try using mseek.  This works best for binary files, but you can use
it like this.

For example with the file you specify saved as c:\temp\tst.txt, I do

fid=mopen("c:\temp\tst.txt","r")
mseek(-5,fid,'end')
mgetl(fid)
 ans  =

 6.0

The actual offset from the end depends on the exact structure of the file.
The 5 bytes here are for the 3 bytes of the last line and the blank line at
the end.

HTH,
Mike.


-----Original Message-----
From: Tima [mailto:meni.tima at hotmail.com]
Sent: 26 June 2012 11:41
To: users at lists.scilab.org
Subject: [scilab-Users] Reading the llast line from a file


Hi,

Does anybody know how to read and save the last line from a file.
For example, I have this /file.txt/
1.0
2.0
3.0
4.0
5.0
6.0


--
View this message in context:
http://mailinglists.scilab.org/Reading-the-llast-line-from-a-file-tp4024440.
html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at
Nabble.com.

--
To unsubscribe from this mailing-list, please send an empty mail to
users-unsubscribe at lists.scilab.org
To check the archives of this mailing list, see
http://mailinglists.scilab.org/



-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2180 / Virus Database: 2437/5093 - Release Date: 06/25/12




More information about the users mailing list