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

Qt Code:
  1. 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.

Qt Code:
  1. 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
cout
. it is not showing any value on
VS2010
. So then i used

Qt Code:
  1. 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
Qt Code:
  1. const char* test= lineEdit->text().toStdString().c_str();
To copy to clipboard, switch view to plain text mode 
is working perfectly on
VS2005
and why not on
VS2010
. Can anyone please guide me where i m doing wrong. Thanks