Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Reading Text
Message
 
 
To
02/11/2001 12:54:54
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00576452
Message ID:
00576872
Views:
26
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform