[Qt-interest] Using QStringList (QT 4.4)

Rodrigo Delduca Batista rodrigodelduca at gmail.com
Tue Dec 9 21:10:41 CET 2008


QStringList lines;
QFile file("in.txt");
if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
   return;

while (!file.atEnd()) {
    lines.append(file.readLine())
}

or

QFile file("in.txt");
if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
   return;
QString str(file.readAll());
QStringList lines = str.split("\n");



More information about the Qt-interest-old mailing list