[Qt-interest] QString doesn't print anything with qDebug
Anisha Kaul
anisha.kaul at hitechroboticsystemz.com
Wed Dec 1 13:22:02 CET 2010
Hello again,
My XML file is filled with relevant data like this:
<?xml version="1.0"?>
<CONFIGINFO>
<ABC>
<portNM>3794</portNM>
<timoutPeriod>10</timoutPeriod>
</ABC>
...
I wrote a small code to print the tag names, and no characters EXCEPT THE SPACES get shown up when I run it.
The relevant (successfully compiled) code is presented here:
_____________________________________________________________________________________________
XmlFileReader :: XmlFileReader (string xmlFileName)
{
QFile *objQFile = new QFile ("config.xml");
if (objQFile->open (QIODevice :: ReadOnly) == false)
{
cout << "\nError: Unable to open the XML file! Verify the file's existence and permissions\n\n";
exit (0);
}
QXmlStreamReader objQXmlReader (objQFile);
QXmlStreamReader :: TokenType token = objQXmlReader.readNext();
QXmlStreamReader :: TokenType token = objQXmlReader.readNext();
QString s = objQXmlReader.readElementText ();
qDebug("--- %s ---",s.toAscii().data());
qDebug("%s", qPrintable(s));
QXmlStreamReader :: TokenType token2 = objQXmlReader.readNext();
QString s2 = objQXmlReader.readElementText ();
qDebug("--- %s ---",s2.toAscii().data());
qDebug("%s", qPrintable(s2));
}
_____________________________________________________________________________________________
Please see if someone can guide me on this.
-Anisha
-------------------------------------
Hi-Tech Gears Limited, Gurgaon, India
More information about the Qt-interest-old
mailing list