[Qt-interest] QString from char array

Scott Aron Bloom Scott.Bloom at sabgroup.com
Wed Jan 21 23:30:21 CET 2009


Way too obvious... you must of read the docs :)

I was just about to recommend that :)

Scott

> -----Original Message-----
> From: qt-interest-bounces at trolltech.com [mailto:qt-interest-
> bounces at trolltech.com] On Behalf Of Clinton Stimpson
> Sent: Wednesday, January 21, 2009 2:23 PM
> To: qt-interest at trolltech.com
> Subject: Re: [Qt-interest] QString from char array
> 
> 
> 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
> >
> 
> _______________________________________________
> 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