Hi ,
before sending this issue to Trolltech maybe some one of you, skilled people, can answer where I'm wrong:
//main.cpp
include <QtCore>
int main(int argc, char **argv)
{
qDebug("%s", s.toLatin1().data());
f.flush();
f.close();
f.setFileName("pippo.txt");
ts.flush(); //does nothing
ts.setDevice(&f); //AGAIN?
s = ts.readLine();
qDebug("This one will not work");
qDebug("First line: %s", s.toLatin1().data());
ts.seek(0);
s = ts.readLine();
qDebug("This one will work");
qDebug("First line: %s", s.toLatin1().data());
return 0;
}
//pippo.txt
** If you read
this line the
QTextStream class works
**
//main.cpp
include <QtCore>
int main(int argc, char **argv)
{
QFile f("main.cpp");
f.open(QIODevice::ReadOnly);
QTextStream ts(&f);
QString s = ts.readLine();
qDebug("%s", s.toLatin1().data());
f.flush();
f.close();
f.setFileName("pippo.txt");
f.open(QIODevice::ReadOnly);
ts.flush(); //does nothing
ts.setDevice(&f); //AGAIN?
s = ts.readLine();
qDebug("This one will not work");
qDebug("First line: %s", s.toLatin1().data());
ts.seek(0);
s = ts.readLine();
qDebug("This one will work");
qDebug("First line: %s", s.toLatin1().data());
return 0;
}
//pippo.txt
** If you read this line the QTextStream class works **
To copy to clipboard, switch view to plain text mode
Bookmarks