64,691
社区成员
发帖
与我相关
我的任务
分享
#include<iostream>
#include<QFile>
#include<QList>
#include <QDebug>
using namespace std;
int main(int argc, char *argv[])
{
QFile file("E:\\test.txt");
if(!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
qDebug()<<"Can't open the file!"<<endl;
}
QList<int> my_list;
while(!file.atEnd()) {
QByteArray line = file.readLine();
QString str(line);
QStringList str_list = str.split("\t");
for(int i = 0; i < str_list.size(); i++)
my_list << str_list[i].toInt();
}
for(int i = 0; i < my_list.size(); i++)
qDebug() << my_list[i];
}