直接 代码:

 1 // lyy : 2016/8/26 16:40:11 说明:读取文本
 2 bool FileOpeartion:: GetTheTextContent (const QString strPath,  QStringList &strContent)
 3 {
 4     QFile file (strPath);
 5     
 6     if (file.open (QIODevice::ReadOnly | QIODevice::Text))
 7     {
 8         QTextStream in (&file);
 9         //in.setCodec (QTextCodec::codecForName ("GB2312"));
10         QString line;
11         
12         while (!in.atEnd())
13         {
14             line = in.readLine();
15             
16             if (!line.isNull() && !line.isEmpty())
17             {
18                 strContent << line;
19             }
20         }
21         
22         file.close();
23     }
24     
25     return true;
26 }
View Code

相关文章:

  • 2021-08-15
  • 2021-09-04
  • 2022-12-23
  • 2022-12-23
  • 2021-11-11
  • 2022-12-23
猜你喜欢
  • 2021-08-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-12
  • 2022-12-23
  • 2021-12-22
相关资源
相似解决方案