How can i make my own function, that accepts parameters in sequence?

 

Hi all.

 

How can i make my own function, that accepts parameters in sequence?

 

Like this :   int filehandle=FileOpen(filename,FILE_READ|FILE_WRITE|FILE_CSV); 

 
  1. Those are simple bit map constants Read=1 Write=2 CSV=8 so the bitwise or operation result is 11.
  2. You make your function accept an int/uint and decompose it using the bitwise and operation:
    type function(... int flags ...){
      bool isRead  = flags & FILE_READ;
      bool isWrite = flags & FILE_WRITE;
      bool isCSV   = flags & FILE_CSV;
    Remember the constants must be powers of 2 (i.e. 1, 2, 4, 8, ...,) so you're limited to 31 of them maximum.
 
whroeder1:
  1. Those are simple bit map constants Read=1 Write=2 CSV=8 so the bitwise or operation result is 11.
  2. You make your function accept an int/uint and decompose it using the bitwise and operation:
    type function(... int flags ...){
      bool isRead  = flags & FILE_READ;
      bool isWrite = flags & FILE_WRITE;
      bool isCSV   = flags & FILE_CSV;
    Remember the constants must be powers of 2 (i.e. 1, 2, 4, 8, ...,) so you're limited to 31 of them maximum.
Thanks my frined!
Reason: