This function creates a new section in the configuration file. Although the PxConfigWrite functions create sections as necessary, sometimes it is necessary to force the creation of an empty section to convey application information. The newly created section becomes the internal current section.
This example, ex_PxConfigForceEmptySection.g, and its configuration file (configtest.txt) are included in the gamma_ph_#_examples_1_QNX4.tgz file available on the Cogent Web Site. A copy of the configtext.txt configuration file is shown in the PxConfigRead reference page.
#!/usr/cogent/bin/phgamma
system("echo \n");
system("echo Copying config file to new file to run tests.");
system("cp configtest.txt configtest2.txt");
system("echo \n");
system("echo --------- Start example ----------");
op = PxConfigOpen("configtest2.txt", PXCONFIG_WRITE);
princ("\nOpened? (0 = no, -1 = yes): ", op,"\n");
princ("Section created? (0 = no, -1 = yes): ",PxConfigForceEmptySection("Section Five"),"\n");
cl = PxConfigClose();
princ("Closed? (0 = no, -1 = yes): ", cl,"\n");
system("echo \n");
system("echo --------- End example ----------");
system("echo \n");
system("echo Running diff to compare old and new config files:");
system("diff configtest.txt configtest2.txt");
system("echo \n");
system("echo Removing new config file.");
system("rm configtest2.txt");
system("echo \n");