I have a function that looks like this:
This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
InstallScript Question '|' operator processing.
Started by
mikenac
, Jun 21 2005 16:38
1 reply to this topic
Posted 21 June 2005 - 16:38
CODE |
#define FLAG1 100 #define FLAG2 200 #define FLAG3 300 prototype foo ( STRING, NUMBER ) function foo ( szString, nFlags ) begin ...................... |
I want to be able to pass the flags to my function, like this:
CODE |
foo ( "Foo", FLAG1|FLAG2); |
What I cannot figure out is how to process these flags inside my function. I tried something like:
CODE |
if ( nFlags && FLAG1 ) then ....... |
This always returns true and is not what I want. It seems like I am missing something simple here, but I can't seem to figure it out.
Any clues?
Thanks.
Posted 22 June 2005 - 17:16
If you use the binary Or operator (|) to comine them then you should also use the binary And operator (&) to parse them, not the logical And (&&) operator.
Stefan Krüger
InstallSite.org twitter facebook