crash when creating xml file

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
kaloskalyre
Posts: 5
Joined: Mon Feb 20, 2006 8:41 am
Contact:

crash when creating xml file

Post by kaloskalyre »

I'm working on a game, and I want it to be able to save and load settings using an xml file. The program crashes whenever I run it (it compiles fine), and CodeBlocks says the problem is in this line:

Code: Select all

IXMLWriter *configWriter = device->getFileSystem()->createXMLWriter(device->getFileSystem()->createAndWriteFile("config.xml", false));
Does anyone see a problem there?
I'm using Irrlicht 1.1 with the MinGW compiler
stef_
Posts: 53
Joined: Tue Apr 18, 2006 9:39 pm
Contact:

Post by stef_ »

It works fine for me:

Code: Select all

#include <irrlicht.h>
using namespace irr;
using namespace core;
using namespace io;
#pragma comment(lib, "Irrlicht.lib")

int main()
{
        IrrlichtDevice *device = createDevice(video::EDT_NULL);

        IXMLWriter *configWriter = device->getFileSystem()->createXMLWriter(device->getFileSystem()->createAndWriteFile("/tmp/config.xml", false));

        configWriter->drop();
        device->drop();

        return 0;
}
Try:
- report debugging/ backtrace here;
- double check every pointer (with printf or assert) instead of doing all in 1 line of code!

Bye
kaloskalyre
Posts: 5
Joined: Mon Feb 20, 2006 8:41 am
Contact:

Post by kaloskalyre »

:oops:
I forgot that I had to "createDevice" before using device!

Thanks for your help, especially the suggestion to use assert :)
Post Reply