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?

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 5 Years Ago 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 5 Years Ago by Arbus: n/a

This article has been dead for over six months. Start a new discussion instead.