[Qt-interest] Why do I get a deprecated conversion warning about string to char*?

Matthias Pospiech matthias.pospiech at gmx.de
Tue Aug 10 14:27:18 CEST 2010


I get this waring everytime I use a char string in the code:
warning: deprecated conversion from string constant to 'char*'

The code looks like this:

sendCommand("BF");

with this definition

void PI_TranslationStage::sendCommand(QString Command, int const value)

{

    QString buffer;

    buffer = Command + QString("%1").arg(value);

    QByteArray ba = buffer.toLatin1();

    char * cbuffer = ba.data();

    MMC_sendCommand(cbuffer);

}

How can I get rid of these messages? And why do they appear?

Matthias



More information about the Qt-interest-old mailing list