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