에 작성/쓰기 할 수 없습니다. 설치된 디렉토리 (C : \ Program Files ...)에 쓰기를 요구하는 Qt 프로그램 (처음에는 Windows 7의 경우 4.7)을 작성하고 있습니다. "보호 된"위치 (프로그램 파일, C : \ etc)에 쓸 때 파일이 생성되지 않습니다. 그러나 QFile 내게 어떤 오류 코드를 제공하지 않습니다. (error()는 0을 반환하므로 정상적으로 작동합니다).Qt는 C :
내가 사용하고있는 코드 스 니핏이 작동하지 않습니다. 나는 그 프로그램의 마지막 부분에서 파일을 닫을 것이다.
QApplication a (argc, argv);
// Setting plugin paths.
QStringList paths = QCoreApplication::libraryPaths();
paths.append(QCoreApplication::applicationDirPath());
QCoreApplication::setLibraryPaths(paths);
// Debug file.
QString path = QCoreApplication::applicationDirPath() + "/debug.dat";
//QFile debugFile(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);
// Processing the arguments.
debugStream << QString("Processing Arguments\n");
누구든지이 문제를 해결하는 방법에 대한 조언이 있습니까? 도움을
감사합니다,
JEC 매니페스트 파일을 추가
이 문제를 해결하기 위해 내가 선택한 길이다.
도움 주셔서 감사합니다.
"그러나 QFile에서 오류 코드를 제공하지 않습니다."debugFile.open()의 반환 값을 확인해야합니다. –