// 读取Text文件中的内容
//并将结果保存在 str中。
void QtWidgetsApplication1::readFile()
{
char data[100];
vector<string> str;
ifstream infile;
infile.open("F:/text.txt");
if (!infile.is_open())
{
qDebug() << "open fail";
exit(1);
}
else
{
// 一行一行读取内容
while (!infile.eof())
{
infile.getline(data, 100);
qDebug() << data << endl;
str.push_back(data);
}
}
}