Can we convert a string of type Qstring to char*?
-
I want to convert because i need to pass to a function which receive char* string argument.
-
You can use QString::toStdString(), and then std::string::c_str(), and I think QString::constData() works as well.
-
All the to_ methods of QString are useful to convert it into another type. There is also a way to convert it to "8 bits":http://doc.qt.nokia.com/latest/qstring.html#toLocal8Bit and to "qbytearray":http://doc.qt.nokia.com/latest/qstring.html#toAscii.
-
You can follow "this DevNet FAQ":http://developer.qt.nokia.com/faq/answer/how_can_i_convert_a_qstring_to_char_and_vice_versa
-
Thread closed, this is a FAQ.