Click here to Skip to main content
Click here to Skip to main content
Alternative Tip/Trick

Tagged as

How to get Present Logical Drives (the bitwise way)

, 19 Dec 2010 CPOL
Rate this:
Please Sign up or sign in to vote.
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 Wink | ;)
 
#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)

Share

About the Author

jean Davy
Engineer
France France
I'm an independent Software Developer living in the Alpes Maritimes (aka French Riviera).
 
Even if in the past I have worked regularily with Fortran, Pascal, Basic (not necessarily Visual), and much more esoteric languages (who knows Prolog, Lotus 123 macros ?), even if I still work from time to time with C#, Java or some "interpreted languages", I'm more specialized in C++.
I work on MFC since the very first version, I enjoy working on Visual Studio 2010, its C++0x features, STL, MFC, boost, WTL ...

Comments and Discussions

 
GeneralReason for my vote of 5 Too hard to pick just one... PinmemberMr Nukealizer27-Dec-10 13:43 
GeneralReason for my vote of 5 Good answer. PinmemberAlain Rist18-Dec-10 6:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web04 | 2.8.141022.1 | Last Updated 19 Dec 2010
Article Copyright 2010 by jean Davy
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid