strcmp not working

You want to do this:

strcmp(buffer, "exit\n")

That is, when you enter your string and press “enter”, the newline becomes a part of buffer.

Alternately, use strncmp(), which only compares n characters of the string

Leave a Comment