Originally Posted by barrygp Why does the first assignment not work in the section of code below.. does not seem to matter whether to8bit is used as well or not.. However, works when you pass it through a string class. Does not work: QString s = QString(tr("whatever")); const char * asdfasdf = s.toAscii().data(); qDebug(asdfasdf); --------------- Works: QString s = QString(tr("whatever")); std::string str = std::string(s.toAscii().data()); const char * asdfasdf = str.c_str(); qDebug(asdfasdf); s.toAscii() create a interim variable that will be released before qDebug(asdfasdf). try qDebug(s.toAscii().data()); It must work.
Forum Rules
Bookmarks