Previous Topic

Next Topic

ctSETHGH

Set the high-order 4 bytes of an 8-byte record address.

Short Name

ctSETHGH()

Type

Low level function

Declaration

NINT ctSETHGH(LONG highword) 

Description

Call ctSETHGH() before a routine requiring a record address as an input parameter to set the high word value for the function.

To minimize the effect on performance in client/Server environments, ctSETHGH() does not make a separate call to the c-tree Server. Instead, the information supplied by ctSETHGH() is cached on the client side.

Return

ctSETHGH() always returns NO_ERROR (0). See “c-tree Plus Error Codes” in the c-tree Plus Programmer’s Reference Guide for a complete listing of valid c-tree Plus error values.

Example

/* Assumes a key length of 14 (8 bytes for HUGE duplicate support) */

LONG recadr_hw,recadr_lw;
pTEXT     keyval;

keyval = "123456";

/* Remember, the high word counts the number of 4GB multiples contained **
** in the composite 8 byte record address. Therefore, recadr_hw = 2 and  **
** recadr_lw = 512 means a record address of 8,589,935,104               */

recadr_hw = 2;
recadr_lw = 512;

/* set higher order 4 bytes of record address */
ctSETHGH(recadr_hw);

if (AddKey( /* add key value to index */
          9,  /* index file number                           */
     keyval,  /* pointer to key value                        */
  recadr_lw,  /* lower order 4 bytes of record address       */
     REGADD   /* regular add mode                            */
))
    printf("\nAddKey error = %d", uerr_cod);

Limitations

The recbyt parameter in this function is a 4-byte value capable of addressing at most 4 gigabytes. If your application supports HUGE files (greater than 4 gigabytes), you must use the ctSetHgh() and ctGetHgh() functions to set or get the high order 4 bytes of the file offset.