Subj : Demo requested
To   : Finnigann
From : Amcleod
Date : Tue Nov 06 2001 12:51 pm

RE: Demo requested
BY: Finnigann to Digital Man / All on Wed Oct 31 2001 03:35 pm

> SEEK_SET
>
> SEEK_CUR
>
> SEEK_END

These aren't functions.  hey are just convenient definitions that can be used
in the "whence" portion of FSET_POS (see below).

> FGET_POS <int_var> <int_var>
>     args: handle    offset

This allows you to find the "current" position in a file and remember it (in
nan INT variable).

   FGET_POS inh marker

takes the current position in the file with handle "inh" and store it in INT
"marker".  Say you had previously done some reads from the file, and you were
now "located" at position 1234 -- your next read will begin at byte 1234.  THen
"marker" will now contain the number 1234.

> FSET_POS <int_var> <int_var or #> [#]
>     args: handle    offset         whence

You can use this to return to a previously marked spot in the file.  Suppose
you did

   FSET_POS inh marker SEEK_SET

you will re-position the file "pointer" back to byte 1234 so you can read
that data again (for whatever reason).  You can use ANY number in the offset
position, not only things that you FGET_POS'd.  Suppose you want to go to
record 15 in a file of records each 45 bytes long.  You can compute the offset
with simple math and FSET_POS to that record.

The "whence" argument allows you to seek from the beginning of the data-set
(SEEK_SET), from the current position (SEEK_CUR) or from the end of the
data-set (SEEK_END) so to go to 40 bytes before the end of the file you can


   FSET_POS inh 40 SEEK_END

and you're there.  Marking and returning to the same spot is very useful when
you are locking data so as to allow multi-user access without conflict.  You
are about to read a record, so when you are at the point of reading you FLOCK
the data, and FGET_POS the position.  Then you read the data as much as you
like, and when you are done you FSET_POS back to the position and then FUNLOCK
the data.

---
� Synchronet � Vertrauen � Home of Synchronet � telnet://vert.synchro.net