Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > irrXML
createIrrXMLReader( ) on non-existing files

dswain
Guest
Quote
2009-06-03 18:14:23

Firstly, thanks for irrXML. It's been great thus far with documentation that actually helps and examples that actually make sense. Pretty sweet change of pace.

My issue right now is when creating the reader on a non-existing file. While it might be safe to assume that they won't enter the file name wrong, I'd rather not take that chance. Here's what I'm doing:

 
IrrXMLReader* xml = createIrrXMLReader( xmlFile );
cout << xmlFile << "\n";
cout << &xml << "\n";

if ( !xml ) {
cerr << "ERROR - Unable to open XML file.\n";
return 2;
}


On a good run:

[dmv45@ash copper]$ ./copper sample.xml
sample.xml
0xbf987574
(more proper output)


On what should be a bad run:

[dmv45@ash copper]$ ./copper sampjfdshfhhsd_file_doesn't_exist
sampjfdshfhhsd
0xbf90fcf4
(more output that shouldn't be seen)


Looking at irrXML.cpp, it seems like there's no particular way to catch to return that something went wrong (from the constructor at least) but the API says it should return 0 on a failure. Do I need to check the files existence myself?

Thanks in advance!


niko
Moderator
Quote
2009-06-04 16:14:15

Yes, that's a small bug in irrXML, it doesn't check if the file exists unfortunately, so you would have to do it yourself.


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Intern?tional" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact