zoukankan      html  css  js  c++  java
  • qt读取文本

    直接 代码:

     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
  • 相关阅读:
    Got05
    Git07
    Git09
    Git11
    Git10
    Git13
    Git12
    Git14
    Listview点击跳转页面
    《三个和尚》观后感
  • 原文地址:https://www.cnblogs.com/ants_double/p/5883775.html
Copyright © 2011-2022 走看看