help need to "read from file until xxxx OR yyyy OR zzzz"
Dar Scott
dsc at swcp.com
Tue Dec 14 12:00:33 EST 2004
See Frank's comments on reading in the file whole.
On Dec 14, 2004, at 7:46 AM, Randy Padawer wrote:
> Can I do the regex routine (something I don't quite yet understand...
> but will soon!) on a file I've not wholly read?
Yes.
Maybe something like this:
Start with an empty line accumulator.
Repeat
Read in a line. (exit if you can't)
If it is a delimiter line then
Process the accumulated lines
put the current line into the accumulator
else
put the current line after the accumulator
You can use regex for the delimiter line match or you can make your own
function that uses contains.
I made some assumptions. You might have to fiddle with what to do with
the first one.
I haven't tried it, but you might run into some problems reading some
fixed number of chars on a file open for text.
Dar Scott
****************************************
DSC
http://www.swcp.com/dsc/
Programming Services
****************************************
More information about the use-livecode
mailing list