Archived

This topic is now archived and is closed to further replies.

Gorf_Rules

Newbie Question

Recommended Posts

DWORD drive = GetLogicalDrives(); Okay I''m wondering how I can pull a certain character from drive, my plan is too create a vector that holds a b c d e f ... z and if its 1 then output the letter that goes with the one? understand?

Share this post


Link to post
Share on other sites
you just do:


drive&(1<<number);

where number corresponds to the drive you wish to check (ie 0 for A etc).
If you really need to do it by letter... you can just convert the letter
you want to use to Uppercase... then subtract 'A' from it. Since the
numbers are sequential in ascii.. that should work... ie:

drive&(1<<('<LETTER>'-'A'));


Hope that helps .

EDIT: My bitshifts weren't appearing, so I put it in a source box.

[edited by - dmounty on November 16, 2003 8:08:32 AM]

Share this post


Link to post
Share on other sites


for( int i; i < dLetters.size(); ++i)
{
if(drive&(1<<(i-1)))
{
TextOut(hdc,200, y, dLetters[(i-0)] +":", 3);
y = (y - 10);
}
}


That is what i''m trying to do, just unsure of the proper way to code it. Its all in a case statement.

Share this post


Link to post
Share on other sites