Product Documentation

FairCom ISAM for C

Previous Topic

Next Topic

UpdateCtResource

Update the specified resource record.

Short Name

UPDRES()

Type

Low-Level file resource function

Declaration

COUNT UpdateCtResource(FILNO filno, pVOID resptr, VRLEN varlen)

Description

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

UpdateCtResource() updates a particular Resource in file filno. resptr points to a resource data block of length varlen. This block contains the following fields:

Byte Offset

Data Type

Field Name

0 - 3

unsigned long integer

Resource Type

4 - 7

unsigned long integer

Resource Number

8 - m

null terminated character string

Resource Name

(m+1) - n

any collection of data types desired

Resource Information

If a record lock has been placed on this resource by GetCtResource(), that lock is released by UpdateCtResource().

Return

Value

Symbolic Constant

Explanation

0

NO_ERROR

Successful update.

57

DADV_ERR

Proper lock not held.

401

RNON_ERR

Resources have not been enabled for this data file.

408

RNOT_ERR

Resource not found. You cannot update a resource that doesn’t exist.

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

Example

struct { /* Resource Data Block structure */

ULONG resource_type;

ULONG resource_number;

TEXT variable_info[1016]; /* This will hold the Resource Name and Data */

} my_resource;


if (GetCtResource(datno, "MY!resource", &my_resource,

(VRLEN)sizeof(my_resource),(RES_NAME|RES_LOCK)))

{

/*at this point you will update the information in the buffer*/

if (UpdateCtResource(datno, &my_resource, sizeof(my_resource))

printf("\nError %d when update resource.",uerr_cod);

else

printf("\nUpdate successful!");

}

else

printf("\nCould not get resource. 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. See also Record Offsets Under Huge File Support.

See also

GetCtResource(), AddCtResource(), DeleteCtResource()

TOCIndex