[Qt-interest] howto convert QString to char*

Oliver.Knoll at comit.ch Oliver.Knoll at comit.ch
Tue Jul 13 18:09:40 CEST 2010


Matthias Pospiech wrote on Tuesday, July 13, 2010 5:46 PM:

> ..
> Is this because ba is destroyed at the end of toChar?

Yes. See the Qt archives for answers. You could memcpy() the data, for instance. Note that your solution assumes that the String only contains Latin1 characters which might be a dangerous assumption.

Cheers, Oliver
-- 
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22



More information about the Qt-interest-old mailing list