- ๐ซ How to reach me [email protected]
Program will use system() in
#include <Windows.h>
#include <cstdlib>
To get information of free and total space of [disk] and write to file.txt
system("fsutil volume diskfree [disk] > file.txt");
And I also coded a function to get Free Space and Total Space in byte and gb to write to a file
ll getFreeSpace(){
ll s = 0;
ll t = freeSpace.find(":");
while(isdigit(freeSpace[t])==false) t++;
while(freeSpace[t] != ' '){
if(freeSpace[t] == ','){}
else if(s==0) s = freeSpace[t]-'0';
else s = s*10 + (freeSpace[t]-'0');
t++;
}
return s;
}
ll getTotalSpace(){
ll s = 0;
ll t = totalSpace.find(":");
while(isdigit(totalSpace[t])==false) t++;
while(totalSpace[t] != ' '){
if(totalSpace[t] == ','){}
else if(s==0) s = totalSpace[t]-'0';
else s = s*10 + (totalSpace[t]-'0');
t++;
}
return s;
}