Jump to content


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.
Photo

InstallScript Question '|' operator processing.


1 reply to this topic

mikenac

mikenac
  • Members
  • 3 posts

Posted 21 June 2005 - 16:38

I have a function that looks like this:


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.

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

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.