Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to say where to write a file to without a dialog
QString RawText (ui->lineEdit->text());
QFile file(RawText & ".txt");
if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
it work but it save it in the folder were the program as in.
[[Merged several similar threads into this one, Tobias]]
How to load type of files in a folder with list view or something like it (qt4)?
[[Merged several identical threads and moved it to General and Desktop, Tobias]]
How to load type of files in a folder with list view or something like it in (qt4)?
QMartin last edited by
That is because your RawText doesn't contain a path. To save it in another location, the ui->lineEdit->text() shall contain the path of your file. For example: if your lineEdit is /home/yourName/Documents/RawText.txt then it will be saved to /home/yourName/Documents directory, but if the lineEdit is only RawText.txt, the current directory will be used. Try writing a complete path in your lineEdit and see how it works.
Writing the text within a text edit to a file (QT4)?
I merged several threads into this one, even though the questions are not identical since they all seem to be about the same general problem you are trying to solve.
Please consider to read a book on C++ programming before continuing. That will make your live much easier.