Hello everyone. I created this little wrapper around WritePrivateProfileString for INI stuff.
It is very basic but provides a much more user friendly interface to INIs from plugins.
INISection.h
Usage:
This snippet assumes you are using the default INI name for your plugin. There is no error checking or defaults for the sectionName, feel free to use this as a starting spot and enhance it.
-Zippzipp
It is very basic but provides a much more user friendly interface to INIs from plugins.
INISection.h
Code:
class INISection {
public:
INISection(char *sectionName){
this->sectionName = sectionName;
}
void setKeyValue(char *key, char *value){
WritePrivateProfileString(this->sectionName, key, value, INIFileName);
}
char *getValueForKey(char *key){
CHAR value[MAX_STRING] = { 0 };
GetPrivateProfileString(this->sectionName, key, "", value, MAX_STRING, INIFileName);
return value;
}
private:
char *sectionName;
};
Usage:
Code:
INISection *section = new INISection("SectionName");
section->setKeyValue("MyKey", "NewValue");
value = section->getValueForKey("MyKey");
This snippet assumes you are using the default INI name for your plugin. There is no error checking or defaults for the sectionName, feel free to use this as a starting spot and enhance it.
-Zippzipp
Last edited: