delorie.com/djgpp/doc/libc/libc_169.html | search |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
#include <dos.h> unsigned int _dos_getdiskfree(unsigned int drive, struct diskfree_t *diskspace); |
This function determines the free space on drive drive
(0=default, 1=A:, 2=B:, etc.) and fills diskspace structure.
The members of struct diskfree_t
are defined by <dos.h>
as
follows:
struct diskfree_t { unsigned short total_clusters; unsigned short avail_clusters; unsigned short sectors_per_cluster; unsigned short bytes_per_sector; }; |
Returns with 0 if successful, non-zero on error (and sets errno
to EINVAL
).
ANSI/ISO C | No |
POSIX | No |
struct diskfree_t df; unsigned long freebytes; if ( !_dos_getdiskfree(0, &df) ) { freebytes = (unsigned long)df.avail_clusters * (unsigned long)df.bytes_per_sector * (unsigned long)df.sectors_per_cluster; printf("There is %lu free bytes on the current drive.\n", freebytes); } else printf("Unable to get free disk space.\n"); |
webmaster | delorie software privacy |
Copyright © 2004 | Updated Apr 2004 |