K
K
koltykov2017-04-03 16:29:01
Qt
koltykov, 2017-04-03 16:29:01

How to find file location for writing in Qt?

The application is located on drive D in the /projects/ folder. I
run the application, both Debug and Release are created there, but it does not pick up .txt files in which I need to write data. Debug figured out ( QDir::currentPath() ) that the current directory is set to c:/users/.....
What needs to be changed to make the application start with release or debug?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
J
Jacob E, 2017-04-03
@Zifix

If you just need to do this, specify the absolute path to the files. If you need to do it more or less correctly, use doc.qt.io/qt-5/qstandardpaths.html#StandardLocatio...

P
Pavel, 2017-04-03
@electronik777

Check the project settings and its variables.

I
Ighor July, 2017-04-09
@IGHOR

You can change the TARGET variable in the .pro file.
Specify, for example, TARGET= ../Bin/MyApp
. You can also access files using the full path:
QCoreApplication::applicationDirPath()+"/config.ini"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question