Qt 6.11 is out! See what's new in the release
blog
How can i save the content of QTextEdit to a file?
General and Desktop
5
Posts
2
Posters
14.2k
Views
1
Watching
-
I got some problem with this.
I tried this:
@
QFile outfile;
outfile.setFileName("detail.txt");
outfile.open(QIODevice::Append);
QTextStream out(&outfile);
out << ui->QTextEdit->toPlainText() << endl;
@
But some information lost.If I write:"
1
2
3
"in the QTextEdit , I will get "123" in the file. All the "\n" are ignored.Anybody knows how can keep the "\n" in my file?
[edit] code wrappings added, koahnig
-
I know why……
In fact, there are 3 "\n". But in windows, "\n" is replaced by "\r\n". When I copy the "123" to MSword, I finally find out that....
-
Thanks!
It helps me a lot!