>How would I read the last line of the text file if the last line has a carriage return after it? Thanks!
lcCRLF=chr(13)+chr(10)
lcFileText = filetostr('MyFile.txt')
lnPos = iif(right(lcFileText,2)=m.lcCRLF,rat(m.lcCRLF,m.lcFileText,2),rat(m.lcCRLF,m.lcFileText))
lcLastLine = substr(lcFileText, m.lnPos+2)
RAT() function accepts three parameters.
As I said earlier, this technique works for not huge files (less than 16MB). Also one-line operation would be faster, but the above commands are easier to read.
If you need to do it for huge files, use Dore's idea.
If it's not broken, fix it until it is.
My Blog