Archived

This topic is now archived and is closed to further replies.

getting the disk size

This topic is 5275 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

whats the easiest, quickest, and hopefuly simplist way to get the size of a disk? preferbly ANY disk, floppy, cd, or HDD. getting free/used space isnt so much an issue, i just need to know the total size (in c++ for MS vs 6.0). thanks in advance Bungo!

Share this post


Link to post
Share on other sites
I don't know how, I don't use it very much , but I know what's the libary u must search it, it coulb be in stdlib.h or dir.h, try google and u probabbly will find that.

Sorry but it was the best I can do for u, I just had used it one time before :
any doubt let me know.



Rodrigo Dietze

[edited by - Dietze on July 7, 2003 7:39:47 AM]

Share this post


Link to post
Share on other sites
Under Win32, use the GetDiskFreeSpace function, which, additionnaly to the free space, gives you the total number of clusters on the drive , the number of sectors per cluster and the number of bytes per sector. Multiply all of them and you get the drive size. Just make sure you use a 64 bit integer since nowadays hard drive are bigger than 4 Gb.

And it''s not limited to HDD only, it should work with any disk (including floppy and CD/DVD).

Share this post


Link to post
Share on other sites