read from file until a line begins with a certain word

Monte Goulding monte at appisle.net
Sun Sep 17 17:15:13 EDT 2017


> On 18 Sep 2017, at 6:13 am, Matthias Rebbe via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> thanks for that code sample. I was not aware that i can use EOF in a repeat loop as condition. I always thought that it only can be used in a read command like

I was not aware of it either and can’t see anything in the engine that indicates it should work.. perhaps I’m missing something… `eof` is a constant. Really the repeat loop doesn’t know which file the `eof` might be referring to so it would be pretty weird syntax.

As far as I know you would need to use something like:

local tResult
repeat until tResult is eof
  read from file tFile until tDelim
  put the result into tResult
  -- process the text here
end repeat

Cheers

Monte


More information about the use-livecode mailing list