[Qt-interest] QString doesn't print anything with qDebug

Andre Somers andre at familiesomers.nl
Wed Dec 1 14:01:08 CET 2010


Op Wo, 1 december, 2010 1:22 pm, schreef Anisha Kaul:
> 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.

>     qDebug("--- %s ---",s.toAscii().data());
>     qDebug("%s", qPrintable(s));

Well, I think you're just making it too complicated for yourself. Why not
a simple:
qDebug() << "---" << s << "---";
No need for a .toAscii().data() at all.

André





More information about the Qt-interest-old mailing list