Previous Topic

Next Topic

CurrentISAMKey

Create an ISAM key from the current ISAM record.

Short Name

GETCURK()

Type

ISAM function

Declaration

pVOID CurrentISAMKey(COUNT keyno, pVOID idxval, pVRLEN plen);

Description

CurrentISAMKey() looks at the current ISAM key buffer for index file keyno and creates a well formed ISAM key. This key is placed at idxval. The length of the key is placed at plen, if plen is not NULL. The ISAM key created with CurrentISAMKey() includes the 4-byte or 8-byte suffix for duplicate keys.

Return

CurrentISAMKey() returns a pointer to the key value. A NULL signifies an error or no current key exists.

Warning: The key buffer is filled with garbage when the return value is NULL on server calls, but non-server calls do not touch the key buffer on NULL returns. Check isam_err for the following error codes on a NULL return.

Value

Symbolic Constant

Explanation

0

NO_ERROR

Successful retrieval of current ISAM record.

22

FNUM_ERR

keyno out of range.

26

FACS_ERR

keyno is not active.

48

FMOD_ERR

keyno does not reference an index file.

See c-tree Plus Error Codes for a complete listing of valid c-tree Plus error values.

Example

COUNT keyfil;
TEXT  keybuf[50];
VRLEN keylen:

if (CurrentISAMKey(keyfil,&keybuf,&keylen) == NULL)
   printf("\nError %d with file %d",isam_err,isam_fil);

Limitations

No check is made to determine if idxval points to a region sufficiently large to accept a key. If the area is too small, either code or data will be clobbered. Use GetCtFileInfo() to obtain the key length.

Note, the key value returned by this function will be a properly formatted key value (i.e., HIGH_LOW order, forced to upper case, etc.). The main issue this presents is if binary key values will be displayed on a LOW_HIGH machine, it will be necessary to reverse any numeric segments.

See also

GetCtFileInfo()