我检查了文件的位置是否正确,所以我不知道为什么我的程序不工作。我实际上已经看了几个小时,但我仍然无法找出问题所在。我真的很感激任何意见。
文本文件中的文本: Bob Janurary 1 2000 Math 7A 5 41 7 9 8 8 9
相关代码:
void MainWindow::on_pushButton_clicked()
{
QString name, month, subject, level;
int day, year, apages, total, one, two, three, four, five, six, seven, eight, nine, ten;
QFile file("C:/Users/brandan/Desktop/GUIPrograms/Kumon.txt");
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
QTextStream stream(&file);
QString line;
do
{
qDebug() << "test";
line = stream.readLine();
qDebug() << line;
} while(!line.isNull());
}
}