Hint. Try this program to see why strchr() is handy after fgets() and to see which character you should be searching for:
Try entering something less than 9 characters long. Notice anything odd about the last character outputted?
char buf, *p;
printf("Type something: ");
fgets(buf, sizeof(buf), stdin);
// Print the ASCII value before each character entered
for(p = buf;*p;++p)
printf("(%d) %c\n", *p, *p);
Now try it again, but enter something longer than 8 characters.
Consult an ASCII table if you have to.
Disclaimer: The preceding program and explanation assumes you're in an ASCII environment, which you probably are.