Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Reading Text
Message
 
 
À
02/11/2001 12:54:54
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00576452
Message ID:
00576872
Vues:
29
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform