View Single Post
Old 09-17-10, 02:17 PM   #3
lduguay
Un-Ripped
 
Join Date: Oct 2004
Location: Montreal, Canaduh!
Posts: 1,968
Default Re: C programming issue

FlakMagnet code works fine, you can also try this:

Code:
char	*pszSensorValues[] = {"00011","11000",0};
int	i=0;

while (pszSensorValues[i] && strcmp(sensor_values,pszSensorValues[i]) != 0)) i++;

switch (i) {

	case 0:
                  break;
	case 1:
                   ...
}
To make it cleaner, you can use an enum instead of index values.
__________________

Evga X58|I7 965 3.8GHz|Ultra 120 Extreme|Evga GTX 480 SC|2 x Intel X25-M 80GB RAID 0|Intel 520 - 240 GB|WD Black Caviar 1TB|6GB Corsair XMS3 1600C8 |Corsair 1000W PSU|Antec Twelve-Hundred|DELL U3011|Logitech G500|Logitech G19
lduguay is offline   Reply With Quote