|
-
May 16th, 1999, 09:23 AM
#1
[RESOLVED] Hexadecimal values
I want to use DWORD variable to contain several flags instead of having several seperate bool variables. Can someone tell me what the hex values are to use for each bit in the DWORD variable?
Perhaps a short example?
Cheers
-
May 16th, 1999, 06:21 PM
#2
Re: Hexadecimal values
You get bit by flags&(1<<(bit)), set bit by flags|=1<<(bit); and clear bit by flags&=~(1<<(bit));
- Goran.
-
May 17th, 1999, 04:12 AM
#3
Re: Hexadecimal values
const DWORD option1 = 0x0000001;
const DWORD option2 = 0x0000002;
const DWORD option3 = 0x0000004;
const DWORD option4 = 0x0000008;
const DWORD option5 = 0x0000010;
const DWORD option6 = 0x0000020;
const DWORD option7 = 0x0000040;
const DWORD option8 = 0x0000080;
// etc
class CSomeClass
{
DWORD m_option;
};
bool CSomeClass::SomeFunction( const DWORD p_testOptions )
{
return ( m_option & p_testOptions ) ? true : false;
}
Sally
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
|