else
{
// If the variable is found, make a copy of it
BMCSCopyVariable((CP_CHAR*)"test", buffer, (CP_CHAR*)"test",
(CP_CHAR*)"found x2");
}
// The third search function returns the structure of the found
// variable. This structure contains the variable’s name
VALMANSTRUCT *pValMan;
if(BMCSSearchVal3((CP_CHAR*)"test",(CP_CHAR*)"copied ",&pValMan, 7)!=0)
{
// NotFound!!
}
else
{
// If the variable is found, create a copy of it
BMCSCopyVariable((CP_CHAR*)"test", pValMan->naName.cpcName,
(CP_CHAR*)"test", (CP_CHAR*)"found x3");
}
Changing a Folder’s Name/Attributes
Much like variables, you can change the name of a folder, change its locked status and
get its attributes with the following functions:
int BMCSRenameFolder(CP_CHAR *pcpcOldFolderName,
CP_CHAR *pcpcNewFolderName)
int BMCSFolderLockOn(CP_CHAR *pcpcFolderName)
int BMCSFolderLockOff(CP_CHAR *pcpcFolderName)
int BMCSGetFolderAttribute(CP_CHAR *pcpcFolderName,
UCHAR *pucAttributeData)
int BMCSSetFolderAttribute(CP_CHAR *pcpcFolderName,
UCHAR ucAttributeData)
Unlike variables, when dealing with folders you can get and set the current folder by
calling these functions:
int BMCSGetCurrentFolder(CP_CHAR *pcpcFolderName,
FOLDERMANSTRUCT **pFolderMan, UCHAR *pucFolderNumber)
int BMCSSetCurrentFolder(CP_CHAR *pcpcFolderName,
UCHAR **ppucManTopAdr, UCHAR *pucFolderNumber)
To get the current folder, you pass in a buffer to hold the current folder’s name as well as
a FOLDERMANSTRUCT reference to get the current folder’s struct. For example:
CP_CHAR folderName[sizeof( NAMEBUFFER)+1];
UCHAR ucFolderNumber;
FOLDERMANSTRUCT *pFolderMan;
if(BMCSGetCurrentFolder(folderName,&pFolderMan,&ucFolderNumber)!=0)
{
116