-
Weird function problems
My compiler complains of '}' syntax errors all over the place in this function. I have to comment out the IF statements and their closing brackets (not the enclosed statements) to get it to compile. Take a look, and tell me if you see any problems.
PHP Code:
bool checkArgs(int count, char *value[]) {
char *val;
for (int i = 1; i<count; i++) {
val = value[i];
if (val[1] == '-') // True if a switch is used
if (val[2] == 'A') // 'A'dmin privileges
cout << val << ": Admin Privileges Granted.\n";
}
}
}
return true;
}
-
Count the number of opening and closing braces. they should match, but in your case they don't.
-
Code:
bool checkArgs(int count, char *value[]) {
char *val;
for (int i = 1; i<count; i++) {
val = value[i];
if (val[1] == '-') // True if a switch is used
if (val[2] == 'A') // 'A'dmin privileges
cout << val << ": Admin Privileges Granted.\n";
}
return true;
}
-
[WHISPER]
[CODE] tags...
[/WHISPER]
I see what i did wrong, i forgot to do if (...) {
hehe......
thanks, guys.