Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / C++

How to get Present Logical Drives (the bitwise way)

4.78/5 (5 votes)
19 Dec 2010CPOL 10.2K  
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;
    }
}

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)