Splatify
23rd February 2011, 19:54
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)) {
QTextStream out(&ffile);
out << ui->textEdit->toPlainText();
}
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
it would be written to the file like this:
The Quick brown Fox jumped over The lazy dog
How do i solve this problem
Thanks for your time and trouble
QString savelocation = ui->ComboBox->text();
QFile ffile(savelocation + "/" + ui->lineEdit->text() + ".txt");
if (ffile.open(QFile::WriteOnly)) {
QTextStream out(&ffile);
out << ui->textEdit->toPlainText();
}
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
it would be written to the file like this:
The Quick brown Fox jumped over The lazy dog
How do i solve this problem
Thanks for your time and trouble