[Qt-interest] QString from char array

Clinton Stimpson clinton at elemtech.com
Wed Jan 21 23:23:18 CET 2009


What about the second parameter to QString::fromAscii(...) to specify 
the size?

Clint

RZ wrote:
> I fear I can't - the Qt application is the GUI frontend of a non-QT 
> based middleware. So what I get is just the uint8 array ....
>
>   
>> I have a similar application.
>>
>> I find using QByteArray is more convenient than dealing with char* 
>> because I don't have to worry about null terminators and other "stringy" 
>> things.
>>
>> Karl
>>
>> RZ wrote:
>>     
>>> Hi,
>>>
>>> i'm banging my head against the wall cause the solution should be 
>>> simple. Over some network connection i receive an array of uint8 which 
>>> i want to convert into a QString.
>>> So e.g. in the array there are the values for "test" (116 65 115 116) 
>>> but i can't get a string out of it. I tried 
>>> QString::fromAscii/Local8Bit/....((const char*)array) but I always get 
>>> garbage.
>>> It can't be that complicated but i just can't find the right way.
>>>
>>> Thx for any help,
>>>
>>> RZ
>>> _______________________________________________
>>> Qt-interest mailing list
>>> Qt-interest at trolltech.com
>>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>>>
>>>
>>>   
>>>       
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>   




More information about the Qt-interest-old mailing list