Coder Profile - Show off your skills, get a coder profile.
 
 
 
code pin board Flags :o Download Source Code
Author Details Code Information
Uranium-239 ( Andrew Carter )

Pinned 1 Codes
Posted 2 Coding Articles

Send A Message
View Coders Profile
Language C++
Expires Never
Length 377 Characters (17 Lines)
Password no password
Description

How to retrieve multiple parameters
  1. #define FLAG_TYPE unsigned int
  2. #define FLAG(x) (0x01 << x)
  3.  
  4. #include <stdio.h>
  5.  
  6. void FlagsPassed(FLAG_TYPE flg){
  7.           unsigned char a;
  8.           for(a = 0;a < 32;a++){
  9.                     if(flg & FLAG(a)) printf("%i Passed\n",a);
  10.           }
  11. }
  12.  
  13. int main(int argc,char *argv[]){
  14.          FlagsPassed(FLAG(1) | FLAG(5) | FLAG(23) | FLAG(31));
  15.          // can use any flag 0-31
  16.          return getchar();
  17. }
code pin board Back To Code Pin Board Post New Code
Please login to post comments.
Page 1 of 1
 
 
Part of the MyPingle Network
Development Blog :: Make A Donation :: Contact Me
Terms & Conditions :: Privacy Policy :: Documents
Version 1.44.00
Copyright © 2007 - 2008, Scott Thompson, All Rights Reserved