[BUG] write to file

Richard Gaskin ambassador at fourthworld.com
Mon Jan 25 10:49:57 EST 2016


Roger Eller wrote:

 > I do the same if I am modifying a specific line in an existing file.
 > However, if I am appending to a file such as for logging, I use the
 > before or after modifiers in a file URL.
 >
 > put "Log entry data" after URL ("file:" &>
      specialFolderPath("documents") & tLogFileName)

As I work my way through Robert Love's "Linux System Programming" (and 
admittedly mostly ignorant about system calls beyond what I've read 
there thus far), my hunch is that using "open...for append" would be 
slightly more efficient than "write...after", since the former takes 
advantage of system calls optimized for logging.

However, in your case you're using the URL syntax rather than 
open/write/close, which leads me to a question for the dev team or 
anyone who's had the opportunity to look at the relevant part of the 
engine source:

When using the statement above, is the engine clever enough to use an 
append operation for that, or does it seek to the end of the file before 
writing?

-- 
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  Ambassador at FourthWorld.com                http://www.FourthWorld.com





More information about the use-livecode mailing list