fehler beim auslesen einer xml datei
-
[code]#include <irrXML.h>
#include <stdio.h>
using namespace irr;
using namespace io;#include <string> // we use STL strings to store data in this example
int x=3;
int main()
{
IrrXMLReader* xml = createIrrXMLReader("config.xml");// strings for storing the data we want to get out of the file
std::string modelFile;
std::string messageText;
std::string caption;// parse the file until end reached
while(xml && xml->read())
{
switch(xml->getNodeType())
{
case EXN_TEXT:
// in this xml file, the only text which occurs is the messageText
messageText = xml->getNodeData();
break;
case EXN_ELEMENT:
{
if (!strcmp("startUpModel", xml->getNodeName()))
modelFile = xml->getAttributeValue("file");
else
if (!strcmp("messageText", xml->getNodeName()))
caption = xml->getAttributeValue("caption");
}
break;
}
}
printf("%s",messageText);
printf("%i",modelFile);
printf("%c",caption);printf("%i",x);
scanf("%i",x);
// delete the xml parser after usage
delete xml;
return 0;
}ich bekomme aber fehler in form von:
39 C:\Users\dixx\Desktop\irrxml-1.2\example\test.cpp [Warning] cannot pass objects of non-POD type `struct std::string' through `...'; call will abort at runtimeWieso? Wie muss ich das machen
-
cout statt printf verwenden. oder messageText.c_str() etc., wenns denn die olle c-funktion sein soll.
-
ekelhafter Mischmasch von C++, C und unformatiertem Code ...