LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] hard disk space in C

[ILUG] hard disk space in C

Matt Rudge mrudge at hcs.ie
Mon Oct 14 16:54:03 IST 2002


Carlos Luna wrote:
> Hi folks!
> 
> What's the best way to get the available amount of hard disk space for a
> given partition in C?
> 
> Thanks!
> Carlos
> 

Trawling back through my old sample C programs produced this......

int diskfree(int drive, struct FREESPACE *df)
{
union REGS regs;

    regs.x.dx = drive;
    regs.x.ax = 0x3600;
    intdos(&regs,&regs);
    if (regs.h.al == 0xFF)
       return 1;
    df->secs_cluster = regs.x.ax;
    df->avail_clusters = regs.x.bx;
    df->sec_size = regs.x.cx;
    df->num_clusters = regs.x.dx;
    return 0;
}

Usual disclaimers apply - and may also be completely useless and not 
what you're looking for at all :)

Actually it looks like it doesn't do partition level, but it might be 
enough to point you in the right direction.  If not, it's in your 
braincells now, so you're stuck with it ;)

Regards

-- 
Matt Rudge
Technical Director
http://www.hcs.ie




More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell