To save a profile to a different description, load a new KcsIO so that the KcsProfile object can save itself. This is accomplished with the same mechanism as that described in steps 2 to 5 of "Creating a KcsIO Object". Example 3-11 is a KCMS "C" API code excerpt that saves a profile to a different description.
/* Application opens the file */
if ((sfd = open(argv[2], O_RDWR|O_CREAT, 0666)) == -1) {
perror ("save open failed");
exit (1);
}
desc.type = KcsFileProfile;
desc.desc.file.openFileId = sfd;
desc.desc.file.offset = 0;
status = KcsSaveProfile(profileid, &desc);
if(status != KCS_SUCCESS) {
status = KcsGetLastError(&errDesc);
printf("SaveProfile error: %s\n", errDesc.desc);
}