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(®s,®s);
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
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!