[Qt-embedded-interest] How can convert QString to const char* ?

sunote sunote at yeah.net
Sat Jul 19 11:54:23 CEST 2008


 
 hi, everyone. 

I have problem where I try to convert QString to const char*.

I get QString from QMultiLineEdit, convert it to const char*  message, and send messge to serial port.

I have tried several method provided by the QT document,but all have error, There methods are:

(const char*)QString
QString::latin1()
...

I have read the source code of qstring, I find all those method worked by QString::latin1().

The  error is that I iuput "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx....." to QMultiLineEdit, and prinft the things in const char in Hex, first 4 to 8 characters is wrong, and the number of wrong character numbers seems corelated with number of input characters..

I want to konw how can convert QString to const char* ? Especially I input Chinese characters, How can i do this?

Thanks..

My QT version is qt-2.3.10..


 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.trolltech.com/pipermail/qt-embedded-interest/attachments/20080719/c5c6eb85/attachment.html 


More information about the Qt-embedded-interest mailing list