| M E M _ F I N D I N F I L E ( )
| | | | | SOURCE: qdev_autodocs.txt 1.163 (12/09/2014) English
PORTA - MEM_#?
----------------------------------------------------------------------------
NAME
mem_findinfile() - Allows to search in a file (by FH).
SYNOPSIS
res = mem_findinfile(buflen, fd, data, datalen, hits);
LONG mem_findinfile(ULONG, LONG, UBYTE *, LONG, LONG);
FUNCTION
With this one you are able to find either, a NULL terminated
string or bin. data in a file. The search is case sensitive!
INPUTS
buflen - Buffer size used for sequential reading. It can be
0 so the default value defined in 'mem_scanfile()'
will be used. Generally 8192 to 65536 bytes is OK
in most cases, but if you need to seek for 512 k
pattern for instance then double that value here!
Passing negative val. switches to case insensitive
mode.
fd - Standard BCPLed FileHandle as get with 'Open()'.
data - NULL terminated string or binary data.
datalen - Length of 'data', passing -1 will determine size of
NULL terminated string.
hits - How many times data should occurr, passing -1 here
will produce total number of hits per file, passing
0 will report last occurrence at its location in
bytes, passing 1 will try to find the very first
occurrence; numbers equal/higher than 1 may be used
to test if this much times 'data' appears to be in
a given file.
RETURNS
May return byte at which 'data' was found or total 'data'
occurrences, depending what was passed in 'hits' argument.
It may also return these error codes: -2 if file could not
be opened or there was not enough memory, -1 will be set
if 'data' was not found anywhere in the file.
BASES
SysBase, DOSBase
NOTES
Function can safely be terminated with SIGBREAKF_CTRL_C
(Control-C).
If termination signal was used then it must be cleared
('Signal(0L, signal)') after the function returns or else
it will trigger some exception handler or something similar
further.
This function makes it possible to reuse the 'fd' and do
the purely positional find until EOF.
SEE ALSO
mem_scanfile(), mem_findinfileq()
EXAMPLE
None.
BUGS
None known.
----------------------------------------------------------------------------
| |
| |