Hello there, do you have any idea what is the corresponding function of this Win32 api (GetDiskFreeSpace) in standard library?

Thanks. :)

9 Years
Discussion Span
Last Post by jaepi

There isn't one.

GetDiskFreeSpace() is an OS-specific function. If you are looking to find free disk space in linux, google statfs(). That's not a standard function anywhere, but it is a common extension to System V. It obsoletes ustat(), which also does the job.

Hope this helps.


I think I might use the statvfs function. I'm kind of confused with the parameters passed in GetDiskFreeSpace (specially the ones that receives the output).


Uhmm, what do you think is the one that corresponds to the lpBytesPerSector parameter of the GetDiskFreeSpace "BOOL WINAPI GetDiskFreeSpace(LPCTSTR lpRootPathName, LPDWORD lpSectorsPerCluster, LPDWORD lpBytesPerSector, LPDWORD lpNumberOfFreeClusters, LPDWORD lpTotalNumberOfClusters);"

function to the members of the struct statvfs

"unsigned long f_bsize;
unsigned long f_frsize;
fsblkcnt_t f_blocks;
fsblkcnt_t f_bfree;
fsblkcnt_t f_bavail;
fsfilcnt_t f_files;
fsfilcnt_t f_ffree;
fsfilcnt_t f_favail;
unsigned long f_fsid;
unsigned long f_flag;
unsigned long f_namemax;
unsigned long f_type;
char f_basetype[FSTYPSZ];
char f_str[FSSTRSZ];" ?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.