[Qt-interest] Segmentation fault while converting from QString to char*
Srdjan Todorovic
todorovic.s at googlemail.com
Mon Apr 19 12:59:31 CEST 2010
Hi,
On 19 April 2010 10:40, prashant bhutani <prashantbhutani2008 at gmail.com> wrote:
> Hi,
> sorry for previous one.
> On using statement, char *cstr = qstr.toStdString.c_str();
> i got ‘qt_file_name.QString::toStdString’ does not have class type
It's a method. toStdString()
> while on using char *cstr = qstr.toStdString();
> i got cannot convert std::string to char *
I believe you need to call c_str() on the std::string object.
Also note that it's a const char * return type.
-Srdjan
More information about the Qt-interest-old
mailing list