Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Read the text file contents from bottom to top
Message
De
29/11/2003 08:08:19
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00854392
Message ID:
00854419
Vues:
17
>Dear Cetin,
>
>I don't want to do all at once. My requirement is that I want to read the last line of the text file and then remove the line after being reading the same and save the file rest of. It should happen until my pointer not move on the top of the file.
>
>
>Ravi

I think your best option would be LLFF. Open the file, use fseek() to go to the end, and then search backwards. How to search, I am not so sure - perhaps reading a byte at a time, or perhaps more efficient, reading something like the last 100 bytes, and using regular VFP functions to see whether there is a CR/LF combination.

To delete the last line, you can change the filesize. If there is sensitive data, you may want to overwrite it with spaces first.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform