AddCtResource Add a Resource to a data file. Short Name ADDRES() Type Low level file resource function Declaration COUNT AddCtResource(COUNT filno, pVOID resptr, VRLEN varlen) Description AddCtResource() is used to add a Resource to file filno. Every Resource is identified by a unique combination of a Resource Type and a Resource Number. The Resource Number can optionally be assigned by c-tree Plus during the call to AddCtResource(). In addition, each Resource can be identified by a Resource Name. The Resource Name is not guaranteed to be unique. resptr points to a resource data block. This block contains the following fields:
The Resource Type must be a value greater than 65536. 0 through 65536 are reserved for FairCom use. If the Resource Number is a value of 0xffffffffL, c-tree Plus assigns this Resource the next available Resource Number for this Resource Type in the specified data file. AddCtResource() places assigned Resource Number in the Resource Data Block. The Resource Name is optional. c-tree Plus does not guarantee unique Resource Names. Names starting with “FC!” or “RD!”, are reserved for FairCom use. The Resource Information is any collection of data that you wish to store as a Resource. It can be a character string, a structure, or any variable type. Return
See c-tree Plus Error Codes for a complete listing of valid c-tree Plus error values. Example /* add a resource and retrieve using GetCtResource */ struct { /* Resource Data Block structure */
ULONG resource_type; ULONG resource_number; TEXT variable_info[1016]; * Holds Resource Name and Data */ } my_resource;
my_resource.resource_number = 0xffffffffL;
strcpy(my_resource.variable_info + 12,"Actual Resource Data");
(VRLEN)(8+12 + strlen(my_resource.variable_info+12))) == 0 ) { printf("\nThe resource has been assigned number %ld", my_resource.resource_number);
printf("\nThe resource is located at byte offset %ld.", Ge
} else printf("\nCould not add resource. Error #%d",uerr_cod);
See also GetCtResource(), UpdateCtResource(), and DeleteCtResource(). Also refer to “Resources” in the c-tree Plus Programmer’s Reference Guide. |
|||||||||||||||||||||||||||||||||||||||