Subj : Arrays
To   : Reaper Man
From : U. CraZy Diamond
Date : Sat Jul 10 1999 04:09 am

RE: Arrays
BY: Reaper Man to U. CraZy Diamond on Mon Jul 05 1999 05:57 pm

> here is another prob, what are the limitations to disk i/o
> can I read from anywhere in a file and write to anywhere?

Of course.  But you will have to know the field lengths and positions of your
target file and use FLOCK & FUNLOCK to lock the portions you are
reading/writing to/from as well as FSET_POS to move around to these file
positions.
Then use FREAD and FWRITE for file I/O.
ie: To read and write to a 25 char field from a file at file position 256-281
you would open the file in the usual manner, then

FSET_POS <file handle> 256 SEEK_SET  # Move to beginning of record
FREAD <file handle> <var> 25         # Read what's there into <var>(str or int)
FSET_POS <file handle> -25 SEEK_CUR  # Move back to file position
FLOCK <file handle> 25               # Lock that field
FWRITE <file handle> <source> 25     # Write (overwrite) at the current file
                                 #    position from <source>(str or int)
FSET_POS <file handle> -25 SEEK_CUR  # (sigh) move back to file position
FUNLOCK <file handle> 25             # Unlock that record

That's basically it in a nutshell and you will have to fill in the blanks and
add other code required for proper flow and error checking but should point out
some of the pitfalls you might discover whilst trying this.  :)

Hope it helps.

         _UCD_

---
� Synchronet � ��� The Serial Port ��� �807�547�2134