-
November 4th, 2011, 09:47 AM
#1
Dealing with bitmask
Within Win32 API the is a function
getlogicaldrives returns a DWORD , as all logical drives on your system ,
reference here
http://msdn.microsoft.com/en-us/libr...=vs.85%29.aspx ,
it usage it some what cryptic , as it returns all drives as bit mask ,
could some explain what bit mask are and how to use them , as in get some meaning full data out of them.
-
November 4th, 2011, 09:56 AM
#2
Re: Dealing with bitmask
MSDN: Bit position 0 (the least-significant bit) is drive A, bit position 1 is drive B, bit position 2 is drive C, and so on.
Code:
DWORD mask = GetLogicalDrives();
if ( mask & (1 << 0) )
{
// drive A is available
}
if ( mask & (1 << 1) )
{
// drive B is available
}
if ( mask & (1 << 2) )
{
// drive C is available
}
...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|