hi,
whats the advantage of using QTextStream over QFile? i.e i convert to QTextStream (e.g QTextStream in(&file)) and reading the lines, instead of using the Qfile readLine method.
I use QT4.1.3
Thank you,
regards,
sreedhar
hi,
whats the advantage of using QTextStream over QFile? i.e i convert to QTextStream (e.g QTextStream in(&file)) and reading the lines, instead of using the Qfile readLine method.
I use QT4.1.3
Thank you,
regards,
sreedhar
Last edited by sreedhar; 28th June 2006 at 10:36. Reason: mentioning the version of QT
The advantage is the codec ... if you like save file to utf8Originally Posted by sreedhar
QTextCodec *codecutf8 = QTextCodec::codecForMib(106);
or latin
QTextCodec *codeclatin1 = QTextCodec::codecForMib(4);
QTextStream in(&data);
in.setAutoDetectUnicode(false);
in.setCodec(codecutf8);
default go all to latin iso depend on os config....
if you save xml file and other apps like this file on utf8
to read a a utf8 file qt cann not autodetect tahs file is utf8 and destroy the file dual utf8 convert!
to read file ..... if a utf8
if (file.open(QFile::ReadOnly | QFile::Text)) {
inside = QString::fromUtf8(file.readAll());
file.close();
}
sreedhar (29th January 2007)
Bookmarks