[Qt-interest] howto convert QString to char*

Matthias Pospiech matthias.pospiech at gmx.de
Tue Jul 13 18:17:20 CEST 2010


Gabriel M. Beddingfield schrieb:
>
> #define toChar(x) ((x).toLatin1().data())
>
That gives the same output. I use

char *str = const_cast<char*>(strMovement.toLatin1().data());

@Oliver Knoll:
I do not see how to 'memcpy' the data if I do not get usefull data anyway.
And I can be sure that I only have latin1 characters. The macro toChar 
is only defined in my own class.

Matthias




More information about the Qt-interest-old mailing list