PDA

View Full Version : why .fromLocal8Bit() is needed



wagmare
20th March 2009, 08:34
hi friends,
i gone through one good examlpe which use QProcess() and in that i have one doubt ...
i try all the assistant documents but cant find ... what is the difference between this two .. to get readyReadStandardError() from QProcess()


1.
QString path = process.readAllStandardError();
path = outputtextedit->setText(path);

2.
QByteArray newData = process.readAllStandardError();
QString text = outputTextEdit->toPlainText()
+ QString::fromLocal8Bit(newData);
outputTextEdit->setPlainText(text);

why we need to convert QString as like 2 nd one .... what will happen if i use 1 st condition ..?

wysota
20th March 2009, 08:40
The first one will use latin1() encoding conversion, the second one will use conversion dependent on your system.

wagmare
20th March 2009, 08:45
The first one will use latin1() encoding conversion, the second one will use conversion dependent on your system.

thanks for reply .....
which one is best to follow if my process outputted as
"joystick failed due to ... failure and network closed "

we have to use QByteArray() to get output and put that one in QString should be used ..?
if not using QByteArray() will create a problem?