Unsolved .c_str() is not coming up
-
Hi,
I want to perform
ui->lineedit->text()->tostdstring().c_str();
but when I wrote ui->lineedit->text()->tostdstring() , after that .cstr() is not coming up.
How can i slove this??
Thanks. -
include <string> on top of your file
#include <QString> #include <string> ... QString string= "Apple"; std::string s = string.toStdString(); const char* c = s.c_str();
-
@QTlearner90 said in .c_str() is not coming up:
How can i slove this??
You can simply write it.
Also, you can use http://doc.qt.io/qt-5/qstring.html#constData -
you need case correct writing: it's toStdString
the rest was already told in the answers before.