Click here to Skip to main content
15,916,693 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: barcode reading Pin
Anonymous31-Jul-02 8:40
Anonymous31-Jul-02 8:40 
Generalnot clear why & is used Pin
ns31-Jul-02 5:59
ns31-Jul-02 5:59 
GeneralRe: not clear why & is used Pin
Jim Crafton31-Jul-02 6:26
Jim Crafton31-Jul-02 6:26 
GeneralRe: not clear why & is used Pin
Chris Losinger31-Jul-02 6:32
professionalChris Losinger31-Jul-02 6:32 
GeneralRe: not clear why & is used Pin
ns31-Jul-02 6:38
ns31-Jul-02 6:38 
GeneralRe: not clear why & is used Pin
Chris Losinger31-Jul-02 6:45
professionalChris Losinger31-Jul-02 6:45 
Generalaah! Thats what I was looking for! Pin
ns31-Jul-02 6:50
ns31-Jul-02 6:50 
GeneralRe: not clear why & is used Pin
Ravi Bhavnani31-Jul-02 6:54
professionalRavi Bhavnani31-Jul-02 6:54 
It's checking if a specific bit is set.

In the following example, uMask can hold up to 32 distinct flags (since it's a 32 bit quantity). To check if bit 2 (i.e. decimal value 4) is set, we do:
unsigned long uMask = ...;
unsigned long uTest = 0x04;
if (uMask & uTest) {
   printf ("Bit 2 is set");
}
You wouldn't want to simply compare uMask with uTest using the == operator, because that simply tests if they are identical. So in your ADO example (btw I know nothing about ADO), you're checking if the connection happens to be open. If so, you're closing it.

You could write a function to do this check, thereby making the code more readable and maintainable. For example:

bool isAdoConnectionOpen
  (CAdoConnection* pConn)
{
  ASSERT (pConn != NULL);
  return ((pConn->State & adStateOpen) == adStateOpen)
}
You'd use the function in this manner:
if (isAdoConnectionOpen (pConn)) {
   pConn->Close();
}
/ravi

Let's put "civil" back into "civilization"
http://www.ravib.com
ravib@ravib.com
GeneralRe: not clear why & is used Pin
PJ Arends31-Jul-02 8:08
professionalPJ Arends31-Jul-02 8:08 
GeneralShared resources management Pin
Antony B.31-Jul-02 5:40
sussAntony B.31-Jul-02 5:40 
GeneralStill a little lost with GetActiveDocument() Pin
NickOne31-Jul-02 5:22
NickOne31-Jul-02 5:22 
GeneralRe: Still a little lost with GetActiveDocument() Pin
JennyP31-Jul-02 6:23
JennyP31-Jul-02 6:23 
GeneralRe: Still a little lost with GetActiveDocument() Pin
NickOne31-Jul-02 7:03
NickOne31-Jul-02 7:03 
GeneralRe: Still a little lost with GetActiveDocument() Pin
NickOne31-Jul-02 8:06
NickOne31-Jul-02 8:06 
Generalmultipart file download... Pin
behrang7931-Jul-02 5:02
behrang7931-Jul-02 5:02 
GeneralC1010: unexpected end of file while looking for precompiled header directive Pin
Raskolnikov31-Jul-02 4:59
Raskolnikov31-Jul-02 4:59 
GeneralRe: C1010: unexpected end of file while looking for precompiled header directive Pin
RichB31-Jul-02 5:05
RichB31-Jul-02 5:05 
GeneralI hate Microsoft Pin
Raskolnikov31-Jul-02 5:08
Raskolnikov31-Jul-02 5:08 
GeneralRe: I hate Microsoft Pin
Jim Crafton31-Jul-02 6:25
Jim Crafton31-Jul-02 6:25 
GeneralRe: I hate Microsoft Pin
Raskolnikov31-Jul-02 15:58
Raskolnikov31-Jul-02 15:58 
GeneralRe: I hate Microsoft Pin
Christian Graus31-Jul-02 17:02
protectorChristian Graus31-Jul-02 17:02 
GeneralMy bad I though Error lookup tool was for compiler errors.. Pin
Raskolnikov1-Aug-02 11:33
Raskolnikov1-Aug-02 11:33 
GeneralSplash screen Pin
hongheo7631-Jul-02 4:31
hongheo7631-Jul-02 4:31 
GeneralRe: Splash screen Pin
Nish Nishant31-Jul-02 4:43
sitebuilderNish Nishant31-Jul-02 4:43 
GeneralRe: Splash screen Pin
Tomasz Sowinski31-Jul-02 4:48
Tomasz Sowinski31-Jul-02 4:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.