GetDiskFreeSpace

  BOOL GetDiskFreeSpace(lpszRootPathName, lpSectorsPerCluster, lpBytesPerSector, lpFreeClusters, lpClusters)    
  LPTSTR lpszRootPathName; /* optional root path */
  LPDWORD lpSectorsPerCluster; /* sectors per cluster */
  LPDWORD lpBytesPerSector; /* bytes per sector */
  LPDWORD lpFreeClusters; /* number of free clusters */
  LPDWORD lpClusters; /* total number of clusters */

The GetDiskFreeSpace function retrieves information about the specified disk, including the amount of free space on the disk.

Parameters

lpszRootPathName

Points to a null-terminated string specifying the root directory of the disk to return information about. If lpszRootPathName is NULL, the root of the current directory is used.

lpSectorsPerCluster

Points to a variable for the number of sectors per cluster.

lpBytesPerSector

Points to a variable for the number of bytes per sector.

lpFreeClusters

Points to a variable for the total number of free clusters on the disk.

lpClusters

Points to a variable for the total number of clusters on the disk.

Return Value

The return value is TRUE if the function was successful, or FALSE if an error occurred. Use the GetLastError function to obtain extended error information.

Comment

The GetDiskFreeSpace function may be used as either a wide-character function (where text arguments must use Unicode) or an ANSI function (where text arguments must use characters from the Windows 3.x character set installed).

See Also

GetDriveType