Work to grab line 1 or 4 to validate sqlite3 version....

Qt Code:
  1. QString file_get_line(QString fullFileName,int linenr)
  2. {
  3. QString inside ="";
  4. QFile file(fullFileName);
  5. int countnr = 0;
  6. if (linenr > 0) {
  7. if (!file.open(QFile::ReadOnly | QFile::Text)) {
  8. return inside;
  9. }
  10.  
  11. QTextStream in(&file);
  12.  
  13. while (!in.atEnd()) { ////// eben nicht am ende
  14. ++countnr;
  15. if (countnr == linenr) {
  16. inside = in.readLine(0);
  17. if (inside.size() > 0) {
  18. return inside;
  19. }
  20. break;
  21. }
  22. }
  23. file.close();
  24. }
  25. return inside;
  26. }
To copy to clipboard, switch view to plain text mode