65.9K
CodeProject is changing. Read more.
Home

How to get Present Logical Drives (the bitwise way)

starIconstarIconstarIconstarIcon
emptyStarIcon
starIcon

4.78/5 (5 votes)

Dec 16, 2010

CPOL
viewsIcon

10338

Forget all that "C" old bit operator, you are "C++", use the modern STL way ;) #include #include void PrintLogicalDrives(){ using namespace std; bitset lt ld = (int)GetLogicalDrives(); for( char i = 'A'; i <= 'Z'; i++ ) { ...

Forget all that "C" old bit operator, you are "C++", use the modern STL way ;)
#include <bitset>
#include <iostream>

void PrintLogicalDrives()
{
    using namespace std;
    bitset lt< 'Z' - 'A' + 1 > ld = (int)GetLogicalDrives();
    for( char i = 'A'; i <= 'Z'; i++ )
    {
        if( ld[ i - 'A' ] )
            cout << i << ":" << endl;
    }
}