Enumerating through local drives
-
Hi, I am looking for some information on how to enumerate through the list of available drives on the local machine to be displayed to the user. I remember coming across something similar on CP sometime back, but I am unable to locate it now. If someone could point me in the right direction on where to find some sample code or demo progs., it would be greatly apperciated. I am going to be doing this in VC++ (2003), MFC, on Windows. Thanks
-
Hi, I am looking for some information on how to enumerate through the list of available drives on the local machine to be displayed to the user. I remember coming across something similar on CP sometime back, but I am unable to locate it now. If someone could point me in the right direction on where to find some sample code or demo progs., it would be greatly apperciated. I am going to be doing this in VC++ (2003), MFC, on Windows. Thanks
Have you tried
GetLogicalDrives()
orGetLogicalDriveStrings()
?"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
Hi, I am looking for some information on how to enumerate through the list of available drives on the local machine to be displayed to the user. I remember coming across something similar on CP sometime back, but I am unable to locate it now. If someone could point me in the right direction on where to find some sample code or demo progs., it would be greatly apperciated. I am going to be doing this in VC++ (2003), MFC, on Windows. Thanks
Try something like this:
// VanillaConsole.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <windows.h>
#include <iostream>
using namespace std;
int main()
{
DWORD mask = GetLogicalDrives();
for (char letter='A'; mask!=0; mask=mask>>1, letter+=1)
{
if (mask & 1)
{
cout << letter << ":" << endl;
}
}
return 0;
}Steve
-
Try something like this:
// VanillaConsole.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <windows.h>
#include <iostream>
using namespace std;
int main()
{
DWORD mask = GetLogicalDrives();
for (char letter='A'; mask!=0; mask=mask>>1, letter+=1)
{
if (mask & 1)
{
cout << letter << ":" << endl;
}
}
return 0;
}Steve
-
Hi, I am looking for some information on how to enumerate through the list of available drives on the local machine to be displayed to the user. I remember coming across something similar on CP sometime back, but I am unable to locate it now. If someone could point me in the right direction on where to find some sample code or demo progs., it would be greatly apperciated. I am going to be doing this in VC++ (2003), MFC, on Windows. Thanks
See System Information Utility[^].