KCMS Application Developer's Guide

Example


Example 4-10 KcsSaveProfile()

KcsProfileDesc                        desc;
 KcsProfileId                        profileid;
 KcsStatusId                        status;
 KcsErrDesc                         errDesc;

 /*see example kcms_update.c for a full example code */

 desc.type = KcsSolarisProfile;
 desc.desc.solarisFile.fileName = argv[1];
 desc.desc.solarisFile.hostName = NULL;
 desc.desc.solarisFile.mode = 0;
 desc.desc.solarisFile.oflag = O_RDWR
 status = KcsSaveProfile(profileid, &desc);
 if(status != KCS_SUCCESS) {
     status = KcsGetLastError(&errDesc);
     fprintf(stderr,"KcsSaveProfile failed error = %s\n", errDesc.desc);
 }
 KcsFreeProfile(profileid);


Note -

If you are saving a new profile, use the following assignments instead of the assignments in Example 4-10.


desc.desc.solarisFile.mode = 0666;
desc.desc.solarisFile.oflag = O_RDWR | O_CREAT | O_TRUNC;