标签:names 写入 only pen array qstring tmp argc bytearray
#include <QtCore/QCoreApplication> #include <QFile> #include <string> using namespace std; void ReadXml(vector<QString>* pVecSt) { QFile file("F:/Qt/Dome/MainFrm/MainFrm/xml/struct.txt");//F:/Qt/Dome/MainFrm/MainFrm/xml/struct.txt file.open(QIODevice::ReadOnly | QIODevice::Text); QByteArray t = file.readAll(); QString qAllst = t; QStringList StList = qAllst.split("}"); bool bNoFirst = false; QString strValue; // vector<QString> vecSt; for (auto singleSt : StList) { if (!bNoFirst) { strValue = singleSt.mid(15); bNoFirst = true; } else { strValue = singleSt.mid(16); } int indexl = strValue.indexOf("{"); QString value = strValue.mid(0, indexl); if (value.trimmed() !="") { pVecSt->push_back(value.trimmed()); } } file.close(); } void WriteHFile(vector<QString>* pVecSt) { for (auto tmpSt in *pVecSt) { } } int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); vector<QString> vecSt; ReadXml(&vecSt); //写入.h文件函数名 WriteHFile(&vecSt); return a.exec(); }
标签:names 写入 only pen array qstring tmp argc bytearray
原文地址:https://www.cnblogs.com/dianrain/p/10940643.html