[Qt-interest] howto convert QString to char*
Oliver.Knoll at comit.ch
Oliver.Knoll at comit.ch
Wed Jul 14 10:23:17 CEST 2010
Matthias Pospiech wrote on Tuesday, July 13, 2010 6:17 PM:
> ...
> @Oliver Knoll:
> I do not see how to 'memcpy' the data if I do not get usefull data
> anyway.
Well, you should get meaningful data with the appropriate data() method - if not, you are doing something else wrong. The problem is that this data /becomes/ invalid as soon as the original object - where you called data() upon - gets out of scope. So if you need to *keep* this data, as returned by data(), then you need to "memcpy" it into your own array (with the usual caveats of buffer overflows etc.)
Cheers, Oliver
--
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22
More information about the Qt-interest-old
mailing list