[email protected]
[Top] [All Lists]

Re: how to print QString contents - QT4

Subject: Re: how to print QString contents - QT4
From: Till Oliver Knoll
Date: Fri, 31 Aug 2007 13:48:24 +0200
Vahe Avedissian schrieb:

I seem to be having problems printing the data contents of QString objects.

I've tried the qDebug, and printf using the dat, toAscii, to unicode, etc... 
It compiles, but at runtime I either see the first character only, or get a 
crash with
"Illegal instruction" message.

This seemed to work with QT3.x and I cannot find any documentation or examples 
how to do this correctly.

What am I missing?

The last method call to data():

  qDebug ("The string is: %s", theQString.toLatin1().data());

Note that toLatin1(), toAscii() etc. return a QCString only - from this you still need to pass along the actual char * to qDebug, with the data() method.

Cheers, Oliver
*** AutoForm is proud winner of the AUTOMOTIVE NEWS PACE AWARD 2004.
This prestigious award honours our continuous game-changing
innovations and recognizes our commitment to global leadership
in sheet metal forming technology.
AutoForm Engineering GmbH            Tel: +41 43 444 6161
Technoparkstrasse 1                  Fax: +41 43 444 6162
CH-8005 Zurich / Switzerland         www.autoform.com
The information contained in this e-mail is confidential and is
provided only for the intended addressee's use. If you received this
e-mail in error, please delete it and contact us. Thank you.

To unsubscribe - send a mail to [email protected] with 
"unsubscribe" in the subject or the body.
List archive and information: http://lists.trolltech.com/qt-interest/

<Prev in Thread] Current Thread [Next in Thread>