문제

For each OS there is a location for storing temporary data. It could be like: C:/Users/[user name]/AppData/Temp (or so). How can I get this path independently from OS with QT?

도움이 되었습니까?

해결책

It is not possible to get the temp directory for an arbitrary user, but for the current user you can use QDir::temp() or QDir::tempPath().

다른 팁

You want to get QDesktopServices::TempLocation. See http://doc.trolltech.com/qtextended4.4/qdesktopservices.html#StandardLocation-enum for details.

In Qt 5, you can use QStandardPaths::writableLocation(QStandardPaths::TempLocation) to get the temporary directory path as a QString. You'll need to #include <QStandardPaths> to do so.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top