ambiera home ambiera home

Ambiera Forum

Discussions, Help and Support.

Create a new account, Search, or Login:
Name:  Password:    
Ambiera Forum > irrXML
createIrrXMLReader( ) on non-existing files
Author Text

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)


Please enter the missing letter in: "Internati?nal" (you are not logged in)


Text:

 

  

Forum 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


   





Software: Ambiera Light Forum. © 2008-2013 Nikolaus Gebhardt, Ambiera e.U.