#include #include int main() { ULARGE_INTEGER totalBytes; ULARGE_INTEGER freeBytes; // ドライブのパスを指定 LPCWSTR drivePath = L"C:\\"; // ドライブの容量を取得 if (GetDiskFreeSpaceEx(drivePath, NULL, &totalBytes, &freeBytes)) { printf("Total space on drive %ls: %I64u bytes\n", drivePath, totalBytes.QuadPart); printf("Free space on drive %ls: %I64u bytes\n", drivePath, freeBytes.QuadPart); } else { printf("Error getting disk space. Error code: %lu\n", GetLastError()); } return 0; }