Product Documentation

FairCom ISAM for C

Previous Topic

Next Topic

GetCtreePointer

Return a pointer to a FairCom DB state variable structure (CTGVAR).

Short Name

GETCTREE()

Type

Low-Level function

Declaration

pVOID GetCtreePointer(pTEXT regid)

Description

GetCtreePointer() returns a pointer to the FairCom DB state variable structure, CTGVAR, based on the name used in a call to RegisterCtree(). The function declaration returns a pVOID, which should be cast by the application to a pCTGVAR.

This function is useful for obtaining the error variables when ctNOGLOBALS is defined, or when utilizing FairCom DB as a DLL (Dynamic Loadable Library). The most commonly accessed variables from the CTGVAR structure are:

COUNT suerr_cod; /* user error cod, uerr_cod */

COUNT ssysiocod; /* system error cod, errno */

COUNT sisam_err; /* isam error, isam_err */

FILNO sisam_fil; /* isam file number, isam_fil */

The complete global structure, CTGVAR, is located in ctgvar.h.

In V12 the file number typedef was formally changed from COUNT, a two-byte value to FILNO, a four-byte value. Refer to this link for compatibility details. Four Byte File Numbering

Return

If the name used in the call to GetCtreePointer() does not exist, then a NULL is returned, otherwise the pointer to the files CTGVAR structure is returned. No error code is set (or reset) by this call whether successful or not. See FairCom DB Error Codes for a complete listing of valid FairCom DB error values.

Example

pCTGVAR ctWNGV;


ctWNGV = GetCtreePointer(WhichCtree());

isam_err = ctWNGV->sisam_err

See also

NextCtree(), SwitchCtree(), RegisterCtree(), WhichCtree(), UnRegisterCtree()

TOCIndex