Qt how to open a file in current dir ? or what's wrong with this?

前端 未结 4 1194
遥遥无期
遥遥无期 2021-01-18 09:49

I\'m trying to open an xml file in the current location of the executable

        QString path = QDir::currentPath();
        path.append(\"/acc.xml\");
          


        
4条回答
  •  温柔的废话
    2021-01-18 10:16

    Try to use QCoreApplication::applicationDirPath() instead of QDir::currentPath().

    For details see http://doc.qt.io/qt-5/qcoreapplication.html#applicationDirPath

提交回复
热议问题