[Qt-interest] Fwd: Convert a QString to string

Andreas Pakulat apaku at gmx.de
Wed Feb 11 07:30:24 CET 2009


On 11.02.09 11:02:30, chandrasekar wagmare wrote:
> also ...
> QString::toLatin1() returns a QByteArray object. You store a pointer to the
> internal data of that temporary object. "const char* str" is a dangling
> pointer as soon as the QByteArray object goes out of scope. For more
> details, see TT knowledgebase: How can I convert a QString to char* and vice
> versa ? <http://trolltech.com/developer/faqs/faq.2007-01-30.9032238253>

The good old libc way: strdup, strcpy and friends. If you're dealing with
char* then you're back to the basics ;)

Andreas

-- 
You will receive a legacy which will place you above want.



More information about the Qt-interest-old mailing list