I am writing a Qt program (first 4.7 for Windows 7), which requires writing to the installed directory (C: \ Program Files ...). When you try to write to a place that will be "protected" (program files, C: \ etc), files are not created. However, QFile does not give me any error code (error () returns 0, which means that it worked fine).
Here is a piece of code that I am using that does not work. I close its file much later in the program.
QApplication a (argc, argv);
QStringList paths = QCoreApplication::libraryPaths();
paths.append(QCoreApplication::applicationDirPath());
QCoreApplication::setLibraryPaths(paths);
QString path = QCoreApplication::applicationDirPath() + "/debug.dat";
QFile debugFile("C:/debug.txt");
qDebug() << debugFile.error();
debugFile.setPermissions(QFile::WriteUser | QFile::WriteGroup | QFile::WriteOwner | QFile::WriteOther);
debugFile.open(QFile::WriteOnly);
QTextStream debugStream(&debugFile);
debugStream << QString("Processing Arguments\n");
Does anyone have any tips on how to solve this problem?
Thanks for the help,
Jec
Adding a manifest file is the route that I decided to solve this problem.
Thanks for the help.
source
share