[Qt-interest] QString from char array

Karl Ruetz karl.ruetz at sototech.com
Wed Jan 21 23:14:07 CET 2009


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
>
>
>   



More information about the Qt-interest-old mailing list