Hi ,
before sending this issue to Trolltech maybe some one of you, skilled people, can answer where I'm wrong:

Qt Code:
  1. //main.cpp
  2.  
  3. include <QtCore>
  4. int main(int argc, char **argv)
  5. {
  6. QFile f("main.cpp");
  7. f.open(QIODevice::ReadOnly);
  8. QTextStream ts(&f);
  9. QString s = ts.readLine();
  10. qDebug("%s", s.toLatin1().data());
  11. f.flush();
  12. f.close();
  13. f.setFileName("pippo.txt");
  14. f.open(QIODevice::ReadOnly);
  15. ts.flush(); //does nothing
  16. ts.setDevice(&f); //AGAIN?
  17. s = ts.readLine();
  18. qDebug("This one will not work");
  19. qDebug("First line: %s", s.toLatin1().data());
  20. ts.seek(0);
  21. s = ts.readLine();
  22. qDebug("This one will work");
  23. qDebug("First line: %s", s.toLatin1().data());
  24.  
  25. return 0;
  26. }
  27.  
  28. //pippo.txt
  29. ** If you read this line the QTextStream class works **
To copy to clipboard, switch view to plain text mode