Hi all I have been trying to write to a text file. The code i currently have is:
QString savelocation
= ui
->ComboBox
->text
();
QFile ffile
(savelocation
+ "/" + ui
->lineEdit
->text
() + ".txt");
if (ffile.
open(QFile::WriteOnly)) { out << ui->textEdit->toPlainText();
}
QString savelocation = ui->ComboBox->text();
QFile ffile(savelocation + "/" + ui->lineEdit->text() + ".txt");
if (ffile.open(QFile::WriteOnly)) {
QTextStream out(&ffile);
out << ui->textEdit->toPlainText();
}
To copy to clipboard, switch view to plain text mode
The data is being written to the file fine. However there are no return characters between the lines;
e.g. if my text edit held:
The Quick brown
Fox jumped over
The lazy dog
The Quick brown
Fox jumped over
The lazy dog
To copy to clipboard, switch view to plain text mode
it would be written to the file like this:
The Quick brown Fox jumped over The lazy dog
The Quick brown Fox jumped over The lazy dog
To copy to clipboard, switch view to plain text mode
How do i solve this problem
Thanks for your time and trouble
Bookmarks