.find Method

Function:

Finds the Nth instance of data satisfying selected criteria in a file opened "on" a currently selected file number (selection is made through fd.filenum).

Syntax:

fd.find(frompos as dword, byref substr as string, instance as word, dir as forward_back, incr as word, mode as pl_fd_find_modes) as dword

Returns:

File position (counting from one) at which the target occurrence of the substr was discovered, or 0 if the target occurrence of the substr was not found.

The method also affects the state of the fd.laststatus. The following status codes are possible:

0 — PL_FD_STATUS_OK: Completed successfully.

1 — PL_FD_STATUS_FAIL : Physical flash memory failure (fatal).

2 — PL_FD_STATUS_CHECKSUM_ERR: Checksum error has been detected in one of the disk sectors (fatal).

3 — PL_FD_STATUS_FORMAT_ERR: Disk formatting error has been detected (fatal).

4 — PL_FD_STATUS_INV_PARAM: Invalid argument have been provided.

8 — PL_FD_STATUS_NOT_READY: The disk is not mounted.

See Also:

Searching Files


Part

Description

frompos

Starting position in a file from which the search will be conducted. File positions are counted from 1. Will be corrected automatically if out of range.

substr

The string to search for.

instance

Instance (occurrence) number to find.

dir

Search direction:

0 — FORWARD: the search will be conducted from the frompos position and towards the end of the file.

1 — BACK: the search will be conducted from the frompos position and towards the beginning of the file.

incr

Search position increment (or decrement for BACK searches).

mode

Search mode:

0 — PL_FD_FIND_EQUAL: Find data that is equal to the substr.

1 — PL_FD_FIND_NOT_EQUAL: Find data that is not equal to the substr.

2 — PL_FD_FIND_GREATER: Find data with value greater than the value of the substr.

3 — FIND_GREATER_EQUAL: Find data with value greater than or equal to the value of the substr.

4 — PL_FD_FIND_LESSER: Find data with value less than the value of the substr.

5 — PL_FD_FIND_LESSER_EQUAL: Find data with value less than or equal to the value of the substr.