Hello, It seems like a simple task, but I can't find a simple answer.

How do you find out how much extra space you have on drive "X:\".

Is there any simple command like; Size(X:\); ?

Or can someone just give me a few lines of code, NOT 53! I just want that part.

Also, What librairies do I need to include?

7 Years
Discussion Span
Last Post by TailsTheFox

I don't know if this is available on Windows, but on Linux/Unix/Posix systems there is are two functions statvfs() and fstatvfs() that fill a structure that includes the size of blocks on the device and the number of free blocks. All you need to do to find available space is multiply one (f_bsize) by the other (f_bfree). Thats about as simple as you can get, at least on *ix systems. FWIW, I know that Windows does have Posix API's, so they might have these functions, but knowing Microsoft, they also have their own version. Sorry that my MSDN library isn't installed on my system right now, so I can't look it up.

Edited by rubberman: n/a


Hello tailsthefox,
System("DIR") will display the directories of the drive and the number of free space available in bytes. But before doing system("DIR") you must change to the required drive. You need to include stdlib for executing system commands.

Edited by Arbus: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.