Archived

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

Question on GetLogicalDrives()

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

I read the documentation but I can''t seem to grasp it, I''m wondering how it is returned and how to output it or pass it in to something, basicall how do I get the drive letter names?

Share this post


Link to post
Share on other sites
I'm just wondering how I would seperate the drives. So I get DWORD drive = GetLogicalDrive(); but how would I pull c drive then d drive then e drive for example from it? Any website or material or anything that explains it better then msdn would be nice, its a win32 project in C++. Any questions feel free to ask.

[edited by - gorf_rules on November 14, 2003 7:52:42 PM]

Share this post


Link to post
Share on other sites
Each bit of the returned value represents a drive letter:

0000 0000 0000 0000 0000 0000 0000 0000
.... .... ZYXW TSRQ PONM LKJI HGFE DCBA

You just need to create a bit mask to see which drive(s) are there.

For example, to test to see if drives A, C, D, and E are present you would create this mask

0000 0000 0000 0000 0000 0000 0001 1101

which can be rewritten as: 29


Colin Jeanne | Invader''s Realm

Share this post


Link to post
Share on other sites