Qt-interest Archive, April 2007
QByteArray and QString
Message 1 in thread
hi, all
is it possible to convert QByteArray to QString type? if possible, how?
regards
fengli
Message 2 in thread
On 4/29/07, 张凤丽 <zhangfenglisdu@xxxxxxxxx> wrote:
> hi, all
> is it possible to convert QByteArray to QString type? if possible, how?
http://doc.trolltech.com/4.2/qstring.html#QString-8
--
[ signature omitted ]
Message 3 in thread
> is it possible to convert QByteArray to QString type? if possible, how?
What's in the QByteArray? How was the QByteArray filled?
--
[ signature omitted ]
Message 4 in thread
hi, once again
i got QByteArray from QFile.readAll() return values.
regards
fengli
2007/4/30, 张凤丽 <zhangfenglisdu@xxxxxxxxx>:
>
> hi, all
> is it possible to convert QByteArray to QString type? if possible, how?
> regards
> fengli
>
Message 5 in thread
Hi,
> i got QByteArray from QFile.readAll() return values.
How is the file encoded?
By the way, you could use QTextStream to a read a text file (but you would
still need to know the encoding of the file):
http://doc.trolltech.com/4.2/qtextstream.html
--
[ signature omitted ]
Message 6 in thread
ååä wrote:
> hi, all
> is it possible to convert QByteArray to QString type? if possible, how?
> regards
> fengli
QByteArray ba;
QString str(ba); // Constructs a string initialized with the byte array ba
ba = str.toAscii(); // reverse
Lingfa
--
[ signature omitted ]