Reading/Deleting Last Line Of File

Richard Gaskin ambassador at
Tue Feb 9 19:05:42 EST 2010

Would the seek command help?

Presumably it would move the file pointer to the specified point without 
having to load the entire file into RAM.

If you knew your lines were shorter than a given length, say 1000 chars, 
you could so something like:

   open file tFile for append
   seek relative -1000 in file tFile
      read from file tFile until cr
      if it is not empty then
         put it after tBuffer
         delete last line of tBuffer
         write tBuffer to file tFile
      end if
   end repeat
   close file tFile

This is off the top of my head to test before using on real data. ;)

  Richard Gaskin
  Fourth World
  Rev training and consulting:
  Webzine for Rev developers:
  revJournal blog:

More information about the Use-livecode mailing list