Public Group

#### Archived

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

# Newbie Question

This topic is 5480 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## 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 on other sites
No, I dont understand what you mean.

By the way...

##### Share on other sites
0000 0000 0000 0000 0000 0000 0001 0001

So I want to check and display the drives that exist, so a exists and e exists but is there a way to check just the 28th character to see if its 1 or 0?

##### 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 on other sites
so I could do a If(drive&(1<

##### 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.

1. 1
Rutin
41
2. 2
3. 3
4. 4
5. 5

• 16
• 18
• 12
• 14
• 9
• ### Forum Statistics

• Total Topics
633360
• Total Posts
3011524
• ### Who's Online (See full list)

There are no registered users currently online

×