You can create an initialization file or open an existing initialization file by using the PrfOpenProfile function. The function requires a handle to an anchor block and a pointer to the name of an initialization file. If the file does not exist in the given path, the function automatically creates an initialization file.
The following code fragment creates an initialization file named pmtools.ini in the current directory:
HAB hab; HINI hini; hab = WinInitialize(0); if ((hini = PrfOpenProfile(hab, "pmtools.ini")) == NULL){ . . /* File was not created */ . }
If the PrfOpenProfile function is successful, it returns a handle to the initialization file. Otherwise, it returns NULL, and the file is not created. Once you have an initialization-file handle, you can create new sections and settings in the file.
To close an initialization file, you use the PrfCloseProfile function.