1  void MainWindow::on_saveButton_clicked()
2  {
3    QFile data("output.txt");
4    if (!data.open(QFile::Append | QFile::WriteOnly | QFile::Text)) {
5      QMessageBox::information(this, "Warning", "File not open");
6      return;
7    }
8    QTextStream out(&data);
9    QString name;
10   int stno;
11   float ave;
12   name = ui->nameEdit->text();
13   stno = ui->stEdit->text().toInt();
14   ave = ui->aveEdit->text().toFloat();
15   out << name << " " << stno << " " << ave << "\n";
16   data.flush();
17   data.close();
18   clearFields();
19 }