The following example contains a function (ReadRepeatMode) that reads a SCALAR_INT scalar (Repeat mode) from a job folder (F_SYSTEMJOB, F_INSTALLJOB, F_SRVINSTALL, or F_REMPKGJOB) and prints it to the screen:
// Function to read the Repeat mode scalar for a job folder
// and use printf to display the scalar.
// This function uses SmsGetScalarByName.
SMS_STATUS ReadRepeatMode(HANDLE hFolder) // Handle to job folder.
{
SMS_STATUS stat;
SCALAR sc;
char szName[SMS_DATA_BUFF_SIZE];
sc.pszName = szName;
sc.scType = SCALAR_INT;
// Retrieve the scalar.
stat = SmsGetScalarByName(hFolder, // Handle to folder.
"Repeat mode", // Name of scalar to
// retrieve.
&sc // Pointer to SCALAR to
// place scalar data.
);
// Get a string equivalent for Repeat mode.
char *pszStringEquivalent;
char szStringBuffer[BUFF_SIZE];
pszStringEquivalent = szStringBuffer;
switch (sc.dwValue) {
case JOBRPT_NEVER:
pszStringEquivalent = "Never";
break;
case JOBRPT_DAILY:
pszStringEquivalent = "Daily";
break;
case JOBRPT_WEEKLY:
pszStringEquivalent = "Weekly";
break;
case JOBRPT_BIWEEKLY:
pszStringEquivalent = "Biweekly";
break;
case JOBRPT_MONTHLY:
pszStringEquivalent = "Monthly";
break;
default:
wsprintf(pszStringEquivalent, "Unknown value %d", sc.dwValue);
break;
}
// print the value.
printf("%s: %s\n", sc.pszName, pszStringEquivalent);
return(stat);
}