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

Thanks. :)

Recommended Answers

All 4 Replies

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 will try to search and implement that. Thanks!

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];" ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.