Following is a code snippet I used to get directory size in c++:
boost::system::error_code ec;
boost::filesystem::space_info si =
boost::filesystem::space(path, ec);
if (ec.value() == 0) {
cout << si.capacity - si.available;
}
I passed 2 different directory paths to above but both of them gave the same answer. So I am guessing this doesn't works as I need it to. Can someone help me with finding what's wrong with this or give me another alternative for getting the directory size in c++? TIA!
Aucun commentaire:
Enregistrer un commentaire