×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
1
Language: C++
Posted by: Teun Grinwis
Added: Jun 23, 2015 3:26 PM
Views: 2044
Tags: qfile qt
  1.     // Read the new translations
  2.     QFile trFile(_transCsvFile);
  3.     if (!trFile.open(QIODevice::ReadOnly | QIODevice::Text))
  4.     {
  5.         qCritical() HDR << "Error cannot open file:" << _transCsvFile;
  6.         return;
  7.     }
  8.  
  9.     QTextStream in(&trFile);
  10.     in.setCodec("UTF-8");
  11.     int nr=0;
  12.     while (!in.atEnd())
  13.     {
  14.         ++nr;
  15.         QString line = in.readLine().toUtf8();
  16.         QStringList lineLst = line.split("\",\"");
  17.         // etc ...
  18.     }
  19.     trFile.close();
  20.