Number of drives on computer


Get number of volumes on a computer :

#include
#include
#include

using namespace std;

void main()
{
WCHAR driveNameP[MAX_PATH];

DWORD numOfDrives = GetLogicalDriveStrings(MAX_PATH, driveNameP);

for (DWORD index = 0; index < numOfDrives; index+=4)
{
wcout<<driveNameP[index]<<" Type : ";

switch(GetDriveType(&(driveNameP[index])))
{
case 0:
wcout<<"Unkown type";
break;
case 1:
wcout<<"Invalid Root Path";
break;
case 2:
wcout<<"USB Derive";
break;
case 3:
wcout<<"Fixed HDD";
break;
case 4:
wcout<<"Remote Derive";
break;
case 5:
wcout<<"CD/DVD Rom";
break;
case 6:
wcout<<"Ram Disk";
break;
}

wcout<<endl;
}

_getch();
}

Comments

Popular Posts