File - read from EOF

JB sundown at pacifier.com
Sun May 28 23:02:09 CEST 2017


Thanks for the info!

I almost have it by keeping track of what is read.
While Livecode is very fast with text I am trying
to keep the process a small as possible.  If I am
working of 350 files a fews seconds on each file
adds up a lot.

JB


> On May 28, 2017, at 1:29 PM, hh via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> [This certainly depends upon how you read 'sections'.
> If one uses a separator and search backwards then you'll get empty
> before the first if at start of file.]
> 
> When testing this 'ineffective' way (because of searching backwards)
> I found a better method:
> 
> Say your separator is for example c0=numToChar(0) and assume you
> would like to have the sections as they are (not the chars reversed).
> 
> Then you could read once thru the file (don't read in the full file)
> and collect the lengths of your sections by "read from file until c0"
> in an array.
> Then you know the number and lengths of your sections and you could
> use "repeat for each" to read in the sections you want and in the
> order you want. (Using negative start numbers may be comfortable here.)
> 
> This works here and LC is very fast with this.
> 
>> JB wrote:
>> That did not work for me.  When I read the data is
>> put into it so I was putting empty into it after the
>> read to make sure it was clear.
>> I tried not putting empty into it and used,
>> repeat until it = empty
>> but apparently it never became empty.
>> 
>>> hh wrote:
>>>> JB wrote:
>>>> ... I want to read in sections from the EOF and
>>>> stop at the beginning of the file instead reading
>>>> from the start to EOF.
>>>> I have no problems opening, reading and
>>>> closing files or reading in sections.
>>>> Does anyone know the easiest way to determine
>>>> when I reach the start of the file similar to
>>>> using EOF to stop reading at the end of the file?
>>> 
>>> As you know how to read in sections:
>>> Simply read one section after the next one until
>>> it is empty.
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
> 




More information about the use-livecode mailing list