question

kavehrahimi-5744 avatar image
0 Votes"
kavehrahimi-5744 asked SimpleSamples commented

If statement format

Hi , I want to use if for a bool parameter how do I have to use it.
Is "if (CH341SetDeviceNotify=='true')" correct?
Please clarify me by an example.
Thanks

c++
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Don't you read the doc ? =>

 BOOL    WINAPI    CH341SetDeviceNotify(
     ULONG                    iIndex,  
     PCHAR                    iDeviceID, 
     mPCH341_NOTIFY_ROUTINE    iNotifyRoutine );
1 Vote 1 ·
DavidLowndes-6766 avatar image
0 Votes"
DavidLowndes-6766 answered BarrySchwarz-8780 commented

If CH341SetDeviceNotify is a bool, you just need:

 if (CH341SetDeviceNotify)


· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

And if CH341SetDeviceNotify is not a bool, you could use

     if (CH341SetDeviceNotify != 0)
0 Votes 0 ·
WayneAKing-0228 avatar image
0 Votes"
WayneAKing-0228 answered

You should keep in mind that BOOL and bool are not the same thing.

Also TRUE/FALSE are not the same as true/false.

What is the difference between BOOL and bool?
https://stackoverflow.com/questions/6420526/what-is-the-difference-between-bool-and-bool

  • Wayne

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.