I made a project on VS2005 using Qt -4.7.4 version. In that project i used lineEdit and took the text from lineEdit like this
const char* test= lineEdit->text().toStdString().c_str();
const char* test= lineEdit->text().toStdString().c_str();
To copy to clipboard, switch view to plain text mode
The above line worked perfectly but now i am using VS2010 and using the same above line but it is not showing me anything for the test variable.
qDebug()<<lineEdit->text()<<endl;
qDebug()<<lineEdit->text()<<endl;
To copy to clipboard, switch view to plain text mode
The above line is printing the right value of lineEdit but when i am using the `std::string` and then using . it is not showing any value on . So then i used
const char* test= lineEdit->text().toLatin1().data();
const char* test= lineEdit->text().toLatin1().data();
To copy to clipboard, switch view to plain text mode
this above line is now showing me everything perfectly on VS2010.
I have no idea why
const char* test= lineEdit->text().toStdString().c_str();
const char* test= lineEdit->text().toStdString().c_str();
To copy to clipboard, switch view to plain text mode
is working perfectly on and why not on . Can anyone please guide me where i m doing wrong. Thanks
Bookmarks