QT:QString to char conversion

Posted by mawia on Stack Overflow See other posts from Stack Overflow or by mawia
Published on 2010-03-26T13:59:33Z Indexed on 2010/03/26 14:03 UTC
Read the original article Hit count: 284

Filed under:

hi! all, I was tryin to convert a QSting to char* type but by following methods,but those does'nt seem to work.

//    QLineEdit *line=new QLineEdit();{just to describe what is line here}
    QString temp=line->text();
char *str=(char *)malloc(10);
QByteArray ba=temp.toLatin1();
    strcpy(str,ba.data());

can you elobrate the possible flaw with this method ,or tell alternative method.

© Stack Overflow or respective owner

Related posts about qt