I have just started exploring 'Boost' library. My main motive is to find the space details of a directory. I know this can be done using 'boost:: filesystem'.
I am trying to write platform independent code. For windows, it is working fine. And gives proper output for given inputs. But, for a Linux(ubuntu) I can see weird outputs. As I am passing input through the command line, for every input it is showing the same output. I don't know what's wrong here. Your help will be appreciated. Thanks in advance. Also look into image.
code i have written:
int main(int argc, char*argv[])
{
#ifdef BOOST_WINDOWS_API
cout<<"\n Running on windows";
#else
cout<<"\n Running on linux";
#endif
if(argc !=2 )
{
cout<<"\n Invalid inputs";
return 0;
}
fs::path p(argv[1]);
fs::space_info sp = space(p);
cout<<"\n directory capacity is: "<<sp.capacity;
cout<<"\n directory free is: "<<((sp.free;
cout<<"\n directory available is: "<<sp.available;'
cout<<"\n directory capacity is: "<<((sp.capacity/1024)/1024);
cout<<"\n directory free is: "<<((sp.free)/1024);
cout<<"\n directory available is: "<<((sp.available/1024)/1024);
}