#include <QDir> #include <windows.h> #include <QString>
quint64 getDiskFreeSpace (const QString& path) {
QString sCurDir = QDir::current().absolutePath(); QDir::setCurrent( path );
double fTotal; double fFree;
ULARGE_INTEGER free,total; bool bRes = ::GetDiskFreeSpaceExA( 0 , &free , &total , NULL ); if ( !bRes ) return false;
QDir::setCurrent( sCurDir );
fFree = static_cast<double>( static_cast<__int64>(free.QuadPart) ); return fFree; }
|