Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <windows.h>
- #include <stdio.h>
- #include<iostream>
- #include <conio.h>
- // You may want to try wmain() version
- using namespace std;
- int main(void)
- {
- // A pointer to a null-terminated string that specifies a directory on a disk.
- // If this parameter is NULL, the function uses the root of the current disk.
- // If this parameter is a UNC name, it must include a trailing backslash,
- // for example, \\MyServer\MyShare\. This parameter does not have to specify the
- // root directory on a disk. The function accepts any directory on a disk. Here we are using NULL, using the root of the current disk
- setlocale(LC_ALL,"Russian");
- cout << "Подключенные дисковые устройства: " << endl;
- char buf[26];
- GetLogicalDriveStringsA(sizeof(buf),buf);
- char *DRF [] = {"Неизвестно" , "Неправильный путь",
- "Внешний", "Внутренний" , "Сетевое устройство","CD-ROM", "RAM диск"};
- for(char *s=buf; *s; s+=strlen(s)+1)
- cout<<s<<" "<<DRF[GetDriveTypeA(s)]<<endl;
- __int64 lpFreeBytesAvailable, lpTotalNumberOfBytes, lpTotalNumberOfFreeBytes;
- DWORD dwSectPerClust, dwBytesPerSect, dwFreeClusters, dwTotalClusters;
- // If the function succeeds, the return value is nonzero. If the function fails, the return value is 0 (zero).
- LPCSTR pszDrive = NULL;
- BOOL test, fResult;
- test = GetDiskFreeSpaceEx(
- pszDrive,
- (PULARGE_INTEGER)&lpFreeBytesAvailable,
- (PULARGE_INTEGER)&lpTotalNumberOfBytes,
- (PULARGE_INTEGER)&lpTotalNumberOfFreeBytes
- );
- printf("Total number of bytes available for user: %ul\n", lpTotalNumberOfBytes);
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement