Reading/Deleting Last Line Of File
massung at gmail.com
Wed Feb 10 23:13:10 CST 2010
I've read through most of these suggestions, but I'm surprised that the
obvious hasn't been suggested yet (that I've seen): skip everything...
put the length of url "file:myfile.txt" into tEnd
open file "myfile.txt" for text update
seek to tEnd in file "myfile.txt"
>From here just back up a "reasonable" number of characters... say 200. Find
the last CR character, nuke everything else and close the file. Didn't find
one? Try backing up another 200, etc. It'll be a whole lot faster.
Edge case to concern yourself with would be if your file happens to end with
a CR and maybe you want to ignore those cases. But that should be easy
enough to solve.
On Wed, Feb 10, 2010 at 7:06 AM, Warren Kuhl <warrenkuhl at gmail.com> wrote:
> Thanks for all the suggestions. I will look into trying some of them
> to see what works best for me. The file currently contains
> 105,750,304 records.
> I will report back my findings.
More information about the use-livecode