hi, how can i save some information like the keys configuration in an ini file and restore this later.
and to write information of a saved game in a binary format?
there is some class for this?
thanks.
save and restore config files like ini
there is not currently a class for serialization, no.
I suggest using an XML library, such as tinyXML.
In my own code, I am currently using a non-compliant XML class I wrote called qXML:
http://www.skyesurfer.net/keless/IrrLicht/ICE/ (look at version 1.3)
but I plan on switching over to use tinyXML
I suggest using an XML library, such as tinyXML.
In my own code, I am currently using a non-compliant XML class I wrote called qXML:
http://www.skyesurfer.net/keless/IrrLicht/ICE/ (look at version 1.3)
but I plan on switching over to use tinyXML
a screen cap is worth 0x100000 DWORDS
Re: save and restore config files like ini
use libxml2. simple and powerful interface. http://www.xmlsoft.org/Epsilon wrote:hi, how can i save some information like the keys configuration in an ini file and restore this later.
and to write information of a saved game in a binary format?
there is some class for this?
thanks.
here is a quick example of loading an xml file
Code: Select all
xmlDoc *doc = NULL;
xmlNode *root_element = NULL,*curr=NULL;
doc = xmlParseFile("config.xml");
if (doc == NULL) {
DOUT("WARNING: could not xml parse config file,using defaults\n");
} else {
//Get the root element node
root_element = xmlDocGetRootElement(doc);
int size_x = xmlReadInt(root_element,"screen_size_x");
char name[80];
strcpy(name,xmlReadString(root_element,"username");
/*free the document */
xmlFreeDoc(doc);
xmlCleanupParser();
-
madinitaly
- Posts: 92
- Joined: Sat Nov 29, 2003 8:30 pm
- Contact:
If you're programming under Windows, you can simply use functions from Win32 API: GetPrivateProfileSectionNames, GetPrivateProfileString, GetPrivateProfileInt, WritePrivateProfileString and so on... Just look at the Win32 API reference, or here at the MSDN page.