I have written code that uses the fgets function with multiple conditions that call other functions within the code, namely aMethod and bMethod.
int main(void) {
char buffer[1024];
while (fgets(buffer, 1024, stdin)) {
if ((strcasecmp(buffer,"a")) == 0) {
aMethod();
}
if ((strcasecmp(buffer, "b")) == 0) {
bMethod();
}
}
}
I'm not sure why it doesn't reach the if statements. Any help would be great, thankyou.
Aucun commentaire:
Enregistrer un commentaire