Current file position ?

Cubist at aol.com Cubist at aol.com
Tue Jul 20 17:49:38 EDT 2004


sez janschenkel at yahoo.com:
>--- Alex Tweedly <alex at tweedly.net> wrote:
>> How can I find the current file position ?
>> 
>> I found
>>    seek  ..                      to set the current
>> position (either abs or 
>> relative)
>>    read .... at N ...           to read, starting at
>> a specified position
>>    write .... at N ...          to write, starting
>> at a specified position
>> but I can't find how to find the current position.
>
>I'm afraid you can't do that ; please file an
>enhancement request with bugzilla to get a
>'currentPosition' property for open files.
>Please remember to inform the mailing list of the
>number so people can vote on it ;-)
   More precisely, Rev doesn't keep track of such things *for* you. So if you 
want to do it, you have to do it yourself, "by hand". Use a separate 
variable, or custom property, or whatever, to keep track of wherever you are in the 
file you're reading, and adjust the value of that variable (or whatever) every 
time you read from the file.
   Hmmm... If you made that variable (or whatever) multi-line, with each line 
consisting of two items (those being (a) a filepath, and (b) the numerical 
position within the file whose path that is), you could write a file-reading 
handler which keeps track of the position(s) within an arbitrarily large number 
of files at once...


More information about the use-livecode mailing list