# Include "windows. H "# include <qtglobal> int main (INT argc, char * argv []) {unsigned long freebytestocaller = 0, totalbytes = 0, freebytes = 0; bool B; B = getdiskfreespaceex (qstring ("D :/"). tostdwstring (). c_str (), (pularge_integer) & freebytestocaller, (pularge_integer) & totalbytes, (pularge_integer) & freebytes); qdebug () <(qstring ("B = % 1, freebytestocaller = % 2, totalbytes = % 3, freebytes = % 4, \ pularge_integer type = % 5, freebytestocaller type = % 6, \ sizeof (freebytestocaller) = % 7. "). arg (B ). arg (freebytestocaller ). arg (totalbytes ). arg (freebytes ). arg (typeid (pularge_integer ). name ()). arg (typeid (unsigned _ int64 ). name ()). arg (sizeof (freebytestocaller )));}
Note that getdiskfreespaceex is a Windows system function, so you need to # include "windows. H". The implementation of this function is in kernel32.lib.
In addition, the length of the long or long int type in C ++ is 4 bytes, and that of the long type is 8 bytes!
See:
1. Use C ++ to check the disk and obtain the disk information.
2. 64-bit integer (_ int64 and long) in C/C ++)