Ok I am puzzled once again. I just don't understand how C and these functions work. I am trying to find the length of a string that is input. Two problems show up: 1) It appears fgets() is storing a newline unless I input all 8 characters and 2) strlen() is counting 1 more char than there are except when I reach the max of the string and then it counts the correct number of characters. How do you prevent fgets() from storing newline? To me this should be so trivial yet it is confusing me. Any help is appreciated. Thank you.

Code:
    char str[8];
    printf("Enter text: ");
    fgets(str, sizeof(str), stdin);
    printf("\nThe string %s has a length of %u.\n", str, strlen(str));
Output 1:
Enter text: CAFE


The string CAFE
has a length of 5.
Press any key to continue . . .

Output 2:
Enter text: 12345678


The string 1234567 has a length of 7.
Press any key to continue . . .