_DBSeek( ) API Library Routine Example

The following example performs a seek on whatever index controls the order of the table open in the current work area. Note the "?" in the FoxInfo structure is required because the type of index expression is not known.

Visual FoxPro Code

SET LIBRARY TO DBSEEK  
DO CreateTest

INDEX ON ABC TAG ABC
SET ORDER TO TAG ABC
= DBSEEK("This is record 3")  && seeks ABC = "This is record 3"
LIST NEXT 1
USE

PROCEDURE CreateTest
   CREATE TABLE test (ABC C(20))
   APPEND BLANK
   REPLACE ABC WITH "This is record 1"
   APPEND BLANK
   REPLACE ABC WITH "This is record 2"
   APPEND BLANK
   REPLACE ABC WITH "This is record 3"
   APPEND BLANK
   REPLACE ABC WITH "This is record 4"
   GO TOP
RETURN

C Code

#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)
{
   _DBSeek(&parm->p[0].val);
}

FoxInfo myFoxInfo[] = {
   {"DBSEEK", (FPFI) Example, 1, "?"},
};
FoxTable _FoxTable = {
   (FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo
};