Contents of the READ.ME file
This demo program uses a function called FSEARCH() to find strings
within a file. The demo simulates "locate" and "continue" using the
Clipper low level file functions.
FSEARCH() works by reading "blocks" of data into a buffer, and then
searching the block for the specified string. If the string is not
found then the file pointer is repositioned (len(string) - 1) bytes
back from the end of the last block before the next block is read
into a buffer and searched. This technique allows FSEARCH() to find
strings that are spread across the boundry between blocks.
If successful, FSEARCH() sets the file pointer to the start of the
string and returns the string location in number of bytes from the
beginning of file. Otherwise, FSEARCH() returns -1.
Search speed is a function of the size of the block read into memory
and searched (the block size in this demo is set to 16k). For example,
the search time using a 2k block is approximately 4 times longer than
searching with a 16k block. You should experiment with block size to
balance search time against available memory. The upper limit to the
block size is fixed by Clipper at 64999 bytes by my tests (try the
expression, mvar = space(65000) then ?len(mvar) ). This is due to
"overhead" according to Nantucket product support.
2nd Story Computing