Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Find Free Drive space on windows
some of you know how can i retrive the free diskspace for example for drive "c:"?
Thanks and regards.
DenisKormalev last edited by
Use GetDiskFreeSpaceEx() WinAPI function.
At linux you can use stat() and statfs() functions.
andre last edited by
QtMobility has API for that as well. You might want to take a look at that.
I've solved using code below:
freeBytesToCaller.QuadPart = 0L;
if( !GetDiskFreeSpaceEx( drive, &freeBytesToCaller, NULL, NULL ) )
qDebug() << "ERROR: Call to GetDiskFreeSpaceEx() failed.";
int freeSpace_gb = freeBytesToCaller.QuadPart;
qDebug() << "Free drive space: " << freeSpace_gb << "Bytes";
But now i've another issue: How can i convert from QString to LPCWSTR, because in this way i could check about a driver stored into a QString obj.
giesbert last edited by
you can use:
I've found exactly your solution after some tries:
Thanks to all
geidel last edited by
hardcodes.de last edited by
The "boost filesystem library":http://www.boost.org/doc/libs/1_53_0/libs/filesystem/doc/index.htm could help you here. Look out for "space":http://www.boost.org/doc/libs/1_53_0/libs/filesystem/doc/reference.html#space.